Filename basics

Learning Competencies

  • Understand the need for standard conventions of filenames
  • Know the basics
  • Use the filenames as specified in the Handbook.

Time Box

ApplicationTime
Read2 minutes

Why it's important

A website is made up of many files. The files 'talk' or refer to each other in order for a website and all of its parts to work. File names (and folder names) need to be easy for both people and computers to find and then use. Using a standard convention makes this easier.

It seems small but it's important!

The basics

When naming files, we use:

  • lowercase e.g. index.html
  • hyphens to separate words e.g. my-reflections-sprint-1.md
  • standard alphanumeric characters (a-z, 0-9).

There are a few reasons for this. Most operating systems are case sensitive; we always use lowercase so all systems can understand the file name. Special characters (i.e. anything that is not a-z or 0-9) can have specific purpose so may be interpreted as an instruction rather than as a filename.

We use hyphens (-) to separate words because spaces ( ) are not handled well by browsers, servers, and programming languages etc. Some will interpret the space as an indicator of multiple files, instead of just one file. Some will replace the space with "%20" (the character code for spaces in URLs) which would break links on a website. We use hyphens (-) to separate words instead of underscores (_) to help optimize search results. Search engines treat a hyphen as a word separator, but don't treat an underscore the same way.

Filenames in the Handbook

In Foundations, we provide the filenames to use because of the behind-the-scenes marking and admin your Facilitator needs to do in order to mark you off for the NZQA qualification.

When the Handbook specifies a filename, use that filename.

Outside of Foundations, a good guideline is keep the filename short (< 25 characters) but descriptive of the contents. Avoid generic names like document1.html.

Recap

  • Use lowercase e.g. index.html
  • Use hyphens, not underscores or spaces, to separate words e.g. my-reflections-sprint-1.md
  • Use standard alphanumeric characters (a-z, 0-9)
  • When the Handbook specifies a filename, use that filename.