Skip to content

Ability to customize the fingerprint delimiter that goes in between the filename and extension #12658

@nickjj

Description

@nickjj

Currently when you use | fingerprint you'll get back a filename formatted like this:

hello.01b9ba6ec73eaa954a828e8d96392fc4c41238c1aae0da03711fb27ea8007321.jpg

Use case / problem

I'm currently toying around with the idea of converting my 500+ page blog from Jekyll to Hugo and I digest my assets with Jekyll-Assets, but the format of the file is filename-digest.extension (notice the hyphen) which is different than Hugo's filename.digest.extension (notice the period) format.

The concern here is if I switch to Hugo then I'm going to have thousands of images that get a different URL and anyone who hotlinked any of my images on the internet will break. It will also likely destroy any image SEO I've built up over ~10 years since all of those links will break.

Proposed solution

It would be interesting if there were a new config option such as fingerprint.delimiter: "-" to optionally customize this value. It can default to . to remain backwards compatible.

Workaround request

If this proposal gets denied, it would be very much appreciated if someone can drop in a working solution to achieve this.

Edit: After a bit of hacking around and help from @irkode, we arrived at a working solution to apply this specifically to images. Here's a workaround for now: https://discourse.gohugo.io/t/how-to-cache-bust-static-files-with-a-fingerprinted-file-name/50695/18.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions