gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
73.93k stars 7.4k forks source link

Hugo generates "+50" timezone in sitemap when the sitemap template specifies +10 timezone #12495

Closed xuhdev closed 2 months ago

xuhdev commented 2 months ago

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.126.0-32c967551be308fbd14e5f0dfba0ff50a60e7f5e+extended linux/amd64 BuildDate=2024-05-14T13:24:11Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes.

Details

To reproduce:

  1. Download the test site: test.tar.gz. The test site contains layouts/_defaults/sitemap.xml, which is same as the embedded sitemap template, with -07:00 replaced with +10:00.
  2. Run hugo inide the unarchived directory.
  3. public/sitemap.xml contains this line: <lastmod>2024-05-14T19:08:54+50:00</lastmod>, a +50 timezone.
jmooring commented 2 months ago
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05+10:00" ) }}</lastmod>

The above is nonsensical. If you want to include an offset in a layout string it must be 07:00.

Again, this is not a bug, but a conceptual disconnect. Please use the forum (https://discourse.gohugo.io/) for questions and troubleshooting.