Hugo - tip for bringing modified articles to the surface
- FR
- EN
(This post was automatically translated with www.DeepL.com/Translator)
I sometimes modify old articles to add new information and I was looking for a simple way to make them appear on the site and the RSS feed, without modifying my theme:
All you have to do is add a lastmod attribute with the update date to the article metadata:
``yaml lastmod: “2023-08-22
Then modify the site's frontmatter conf, in the _.toml_ or _.yml_ at the root, to give this **lastmod** attribute priority over the **date** attribute:
yaml
frontmatter:
date:
- lastmod
- date
[frontmatter]
date = ['lastmod', 'date']
Some sources:
- Modifying your front matter: https://gohugo.io/getting-started/configuration/#configure-front-matter
- Articles that go much further in their modifications, using the git update date, etc. (and modify their theme to do so):
02/11/2023
https://loboto51.github.io/lobotourisme/en/post/hugo---astuce-pour-faire-remonter-les-articles-modifi%C3%A9s-%C3%A0-la-surface/
map[name:Loboto]You like the blog's content and want to support it?
To keep me motivated (and less sleepy) you can offer me the equivalent of a coffee through the Ko-Fi platform: