I am using the Hugo academic template, but the last update always shows as Jan 1, 0001, and I don’t know where to make changes to fix it. Could you please help me with this problem?
This seems to be an issue that came up before. As far as I remember it had to do with the latest update not being committed to Git yet, which results in a NULL date which in Golang ends up as Jan 1st in the year 1.
Does your newest post have:
- lastUpdated
- published
- date
or anything along the line in its frontmatter? Might be taken if the Git-date is null.
Also: Which hugo version are you using? Did you check with the developer’s support of the theme about this issue?
See this page in the docs for a better understanding how Hugo decides where to retrieve the date:
Hi David,
Thank you for your reply. I am using the Hugo Academic CV, but I couldn’t find the front matter there. I’m using Hugo version 0.115.4, with an older version of the Academic CV theme, which is why I’m using the older version of Hugo. Although I see the following information at the beginning of each .md file, I haven’t been able to fix the issue by setting the correct date:
+++
date = 2024-08-08
lastmod = 2024-08-08
draft = false
tags =
title = “News”
math = true
summary = “”"
List of news.
“”"
+++
Could you please advise on how to resolve this?
is it giving you same output if you change
date = "2024-08-08T00:00:00"
lastmod = "2024-08-08T00:00:00"
ps. you don’t need to have lastmod if date is that same.
Hi idarek,
Yes, I changed it and there is no difference there.
Please share your repo so we can help you further.
Sure, here it is:
your file news.md
contains
date = "2024-08-08T00:00:00"
lastmod = "2024-08-08T00:00:00"
but is not using is as you filling content using
{{< readfromfile "/content/en/news/newslist.md" 1000>}}
Your file newslist.md
does not contain any date:
or lastmod:
.
When I paste
date = "2024-08-08T00:00:00"
lastmod = "2024-08-08T00:00:00"
into newslist.md
the date is displayed correctly.
It worked. Thank you so much for your help.