Can someone explain to me the use of ‘.html.html’ vs ‘.html’ in hugo? particularly for template lookup order. is this a holdover for older versions? dosen’t seem to follow convention that I’m familiar with and I can’t find where docs address it specifically
i have a project where section templates are simple ‘.html’ , like ‘about.html’ under sections, but is ‘.html.html’ more appropriate/best practice?
Do you have a sample project where this pattern is used? I’m not familiar with it personally.
Me neither, but those filenames are referenced in the docs:
Is that what you were looking for?
Ah, I see now. Guess I’ve never noticed that in the docs.
Looks like hugo would use layouts/posts/single.html.html
over layouts/posts/single.html
– but I’ve never seen this being used in the wild.
Maybe others can provide better info.
You would see that where you need to specify two or more output formats where all have the “.html” extension.
The “.html.html” is an outcome of a generic and consistent framework for determining the lookup order.
Scroll a little bit down in that table to see the AMP output format, and you will realize the need for “.html.html”.
Now, if you want a Single page template for both HTML (default) and AMP output formats, you need to distinguish between them … the former named as “single.html.html”, and the latter named as “single.amp.html”.
Nice. Learned something new today.