sorry to intrude into an old post. Is this still the case? I was trying to to create a favicon partial for apple and chrome icons and it would be nice to have a fixed name.
Right. Now that you posted this I vaguely remember having seen the concat method somewhere before.
But since there is an open issue about providing the means to customize the filenames of generated resources, let me tell you that on Windows 10 I have already hit the filename character limit more than once, due to the way that Hugo generates the resources names.
Shorter filenames by default, for Hugoâs generated resources, would be preferable.
Why not use a shorter hash function like SHA-1 to generate them?
P.S. Also I am re-opening the topic for a limited amount of time in case others want to share their way of customizing the filenames.
This is an âsoftâ limit of modern Windows systems.
Help is here
Summary
Once you have Registry Editor opened, and your backup made, navigate to the location HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem and find the key LongPathsEnabled .
Double-click on LongPathsEnabled . In the Value data: field, make sure the number 1 is in there. Click OK to commit the change.
Exit Registry Editor and you should be able to work with crazy long file paths now.
Yes, you are right MD5 is shorter than SHA1 (I stand corrected).
However still Hugoâs generated resources filenames can be too close to the Windows filename limit for comfort. Perhaps the filename calculation could happen otherwise.
I had to manually shorten original filenames so that Hugoâs generated resources do not cause problems on Windows more than onceâŚ
I agree that we should fix it ⌠Iâm not using Windows regulary ⌠Could you create a GitHub issue about it? And esp. cool if you could point to a repo where this breaks on WindowsâŚ
the token can be a timestamp or a hash of the timestamp or a hash of timestamp and a saltâŚ
seems to work even on favicons as I was looking for a cash buster on this one.
The reason for a controlled asset name is that it makes content jobbing easier. The final name of the published asset is the used in the content-creation tasking.
true, but the browser making the request doesnât care about the file on disk. It is talking to an httpd server. The server knows about the filename and it doesnât do cache throttling. As long as all the requests from the browser contain the query with the filename, then Bobâs your uncle.
EDIT#1: I assume it would be quite straightforward to add the logic in the .Permalink methods so it can keep state across a recompile of the static site and update references.
EDIT#2: In fact hugo doesnât need to do much tracking. If you want to enforce cache-busting, all you have to do is add a query to any url. The browser is forced to make a request anyway. If browsers do it for favicons then I assume they do it for anything. Perhaps add a flag to the url that will instruct hugo to add a hash of the modified date timestamp to the query. hugo has to keep track of last file-modification dates for tracked files.
as much as is practical, identification should be in the hands of the site administration. I donât understand what is the distinction of hugo being a âstaticâ site generator. It doesnât do a one off transformation of content. It also keeps a cache between updates to better track changes and increase efficiency. It is still dynamically generating webpages. Instead of doing it at the request of an end user or a cacheing proxy server, it is doing a sweep at the request of site admin.
The process is still very similar and is doing a lot of the same processing. Certainly more dynamic than old-school printing. You cannot get more static than sending a pdf to a printer and getting dead trees in return.
What is wrong with administrators wanting to track published assets by their filename and modified date or any other key that is meaningful to the publisher?
beware that Iâm not really tied to this. That said I would like to have simple filenames. I think query part can be jury-rigged as shortcode or partial with some effort.
EDIT: it would be nice to have access to the created date and modified date in the file variables.