🤯 50% Off! 700+ courses, assessments, and books

Why File Naming is More Important Than You Think

    Craig Buckler

    File namingNaming your web files is not normally considered to be particularly important. Developers rarely spend much time deliberating file and folder names unless they are implementing a REST API or adding keywords that an SEO expert insists will help their marketing effort.

    However, the folder and file names you choose for your HTML, CSS, JavaScript, and graphic files can have a catastrophic effect. As an example, this is how the eBay UK home page looks on my browser today:

    eBay UK

    The reason: I use Adblock Plus, a Firefox add-on that removes adverts from the page. Adblock Plus is the most popular Firefox extension and it has been downloaded 50 million times. Adblock is not alone: there are dozens of freeware, shareware, and commercial advert blockers for all the mainstream browsers. Even unsupported browsers can use web-filtering proxy servers such as Proxomitron.

    As a developer, there is absolutely nothing you can do to stop advert blocking software. The majority of blockers use regular expression rules to check domain names, file names, or HTML code. The reason eBay looks so bad is because several of the core CSS files are being blocked; they do not contain adverts, but their filenames inadvertently trigger Adblock’s rules.

    Although you can not stop advert blockers, you can avoid using advert-like names within your legitimate files and folders to ensure they are not trapped. Typical names to avoid include:

    • any word featuring the text ‘ad’ or ‘advert’. I would even be wary of words such as ‘add’, ‘adjust’ or ‘admin’.
    • combinations of words featuring ‘banner’, ‘click’, ‘server’, ‘bureua’ or ‘syndicate’.
    • inclusion of numbers with standard banner sizes, e.g. my-image-468×60.jpg

    Above all, test your system using a variety of advert blocking software.

    Have you been caught out by advert blockers? Do you have any other suggestions to ensure files are not accidentally blocked?