squirrelscan
GitHub

IMG_1234.jpg: image filenames that describe nothing

A filename straight off a camera or a hash tells nobody what the picture is. squirrel matches image filenames against a list of generic patterns.

What an image filename does

The filename is one of the few pieces of text attached to an image file itself, and Google’s image guidance names it alongside the alt text and the surrounding copy as a signal about what an image shows.

It also matters when the alternatives fail. A screen reader with no alt to read often falls back to the filename, and a downloaded image keeps its name in the user’s folder. red-running-shoes.jpg is useful in both cases; IMG_20231015.jpg is not.

What squirrel checks

The rule runs on every crawled page over every img[src], taking the last path segment with any query string removed. data: sources and .svg files are skipped. The filename without its extension is matched against thirteen patterns.

  • Skipped when the page has no images. Message: No images found.
  • Pass when at least one filename is descriptive and none are poor. Message: All 12 image(s) have descriptive filenames.
  • Info when any filename matches a poor pattern. Message: 4 image(s) with non-descriptive filenames, listing up to three examples.

The patterns catch camera and device names such as IMG_001, DSC1234, DCIM001 and P20231015, generic names such as image1, photo1, pic1, screenshot, screen-shot and untitled, and machine identifiers: a name starting with eight or more digits, one starting with 32 or more hexadecimal characters, or one starting with 36 or more hexadecimal characters and hyphens. The last two are prefix tests rather than exact hash or UUID validation. Severity info, weight 2.

Elements inside <noscript> are skipped: a browser with scripting enabled reads <noscript> content as plain text, so nothing in it loads or renders. See content inside noscript.

How to fix it

/images/red-running-shoes-side-view.jpg

Rename on upload, deriving the name from the title or the alt text: lowercase, hyphens between words, no more than a few words. Most CMSes can do this automatically.

A long content hash at the start of a filename matches the machine-identifier patterns. A short one such as a1b2c3d4.jpg does not, and neither does a name that leads with words and carries the hash after them, which is the shape worth keeping anyway.

Rule IDimages/filename-quality
CategoryImages
ScopePer-page
Severityinfo
Weight2/10

Enable / disable

Disable this rule

[rules]
disable = ["images/filename-quality"]

Disable all Images rules

[rules]
disable = ["images/*"]

Enable only this rule

[rules]
enable = ["images/filename-quality"]

enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.

Images findings ship in every audit next to the SEO, performance and agent experience rules. See Core Web Vitals for how an agent works through a report.

References

Check your site

Run squirrel audit https://example.com and open the Images section of the report. Up to three example filenames are listed for each page. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.

Type to search…

↑↓ navigate↵ openesc close