import{_ as e,c as s,o as a,R as n}from"./chunks/framework.ade46834.js";const g=JSON.parse('{"title":"File Name Conventions","description":"","frontmatter":{},"headers":[],"relativePath":"development/file-naming-convention.md","filePath":"development/file-naming-convention.md","lastUpdated":1686503450000}'),i={name:"development/file-naming-convention.md"},l=n(`

File Name Conventions

A collection of guidelines for writing file names used in web projects.

Possible characters

Use dashes as delimiters

Right:

file-name-with-dashes.en.min.html
file-name-with-dashes.en.min.html

Do not use special characters

Avoid using non-alphanumeric characters in file names, such as: '*' ':' '\\' '/' '<' '>' '|' '"' '!' '?' '[' ']' ';' '=' '+' '&' '£' '$' '' '%' or ','. These characters can have special meaning in programming languages or can cause problems with different operating systems.

Use lowercase, never uppercase

We should always consider URLs as case-sensitive according to W3.org. Therefore, use lowercase to reduces errors when typing URLs.

Write sections of a file name in a consistent order

Sections should be written in this order:

  1. Description
  2. Number
  3. Date
  4. Target device, image size, pixel density
  5. Version number
  6. Status
  7. Language code
  8. File conditions

Possible combinations

description-01-20150102-palm-1.0b-draft.en.min.js /* extreme combination */
description.min.js
description.en.html
description-01.jpg
description-02.jpg
description-1024x768_2x.jpg
description-desk_2x.jpg
description-01-20150102-palm-1.0b-draft.en.min.js /* extreme combination */
description.min.js
description.en.html
description-01.jpg
description-02.jpg
description-1024x768_2x.jpg
description-desk_2x.jpg

Write description for developers and users

Don't be afraid to write long informative file names. Few people type a file name manually and most operating systems support 255 characters. But only add information that makes it easy for users and developers to recognize files from one another at a glance. For the description use information such as:

Give your images detailed, informative filenames The filename can give Google clues about the subject matter of the image. Try to make your filename a good description of the subject matter of the image. For example, my-new-black-kitten.jpg is a lot more informative than IMG00023.JPG. Descriptive filenames can also be useful to users: If we're unable to find suitable text in the page on which we found the image, we'll use the filename as the image's snippet in our search results. - Google, 2015, Image publishing guidelines

Keep people's names compact

Sometimes you want to include the name of a person in the file name, e.g. the author or the person in the photo.

Right:

bvandebiezen.jpg
shoogenhout.jpg
a-very-long-description-with-name-bvdb.jpg
asmith.jpg
adamsmith.jpg
adamsmith2.jpg
bvandebiezen.jpg
shoogenhout.jpg
a-very-long-description-with-name-bvdb.jpg
asmith.jpg
adamsmith.jpg
adamsmith2.jpg

Use two or more digits to distinguish sequential files with the same description

Right:

description-01.jpg
description-02.jpg
description-03.jpg
description-04.jpg

01-description.jpg
02-description.jpg
03-description.jpg
04-description.jpg
description-01.jpg
description-02.jpg
description-03.jpg
description-04.jpg

01-description.jpg
02-description.jpg
03-description.jpg
04-description.jpg

Keep dates or date ranges compact and start with year

Right:

description-20150401.php
description-201504.php
description-2015.php
description-2000--2010.php
description-20150401.php
description-201504.php
description-2015.php
description-2000--2010.php

See 'ISO 8601' for further reading.

Use special modifiers for target devices, image sizes or media queries, and pixel densities.

Modifiers are inspired by Apple iOS naming conventions. There are some differences. Apple uses '@' as a delimiter for the section indicating higher resolution images, for example '@2x' for retina images. Because '@' is a reserved character and can create problems, we use Bourbon's convention: an underscore. Also, Apple uses a tilde (~) as a delimiter for a section indicating specific devices. Because also a tilde can create problems, we suggest to simply use a dash.

Right:

description_2x.jpg
description-lap.jpg
description-desk.jpg
description-lap_2x.jpg
description-palm-1024w_2x.jpg
description-iphone5-568h_2x.jpg
description-palm-1024x768_2x.jpg
description-40max.jpg
description_2x.jpg
description-lap.jpg
description-desk.jpg
description-lap_2x.jpg
description-palm-1024w_2x.jpg
description-iphone5-568h_2x.jpg
description-palm-1024x768_2x.jpg
description-40max.jpg

Use version numbers if available

Right:

description-0.5.js
description-1.0b.js
description-1.0rc1.js
description-0.5.js
description-1.0b.js
description-1.0rc1.js

Add status when needed

Right:

description-draft.md
description-draft.md

Add language code only when different languages are available

Right:

description.nl.txt
description.en.txt
description.nl.txt
description.en.txt

Add file conditions just before the file extension

Right:

description.min.js
description.custom1234.min.js
description.min.js
description.custom1234.min.js

Rewrite original file names not following conventions

It is not preferred to keep file names in it's original format if it doesn't match your file name conventions. But in some cases it is easier to keep the file name untouched. Sometimes you want to easily replace a file with a newer one from the original source in the future.

`,57),o=[l];function r(t,p,c,d,h,m){return a(),s("div",null,o)}const b=e(i,[["render",r]]);export{g as __pageData,b as default};