Code working on local hugo server but not remote

I am trying this code to show an archive of all my posts:


{{ $prev := 3000}}
{{range where .Site.RegularPages "Section" "post"}}
{{if .Date}}
{{if gt $prev (.Date.Format "2006")}}
## {{ .Date.Format "2006" }}
{{.Date.Format "02 Jan"}} -- [{{.Title}}]({{.Permalink}})
{{ $prev = .Date.Format "2006"}}


title: Archive
sidebar: true

{{% archive %}}

Works on local hugo server when I run

hugo server -D

but not on remote server. Tried both via Netlify and Cloudflare pages.

Is it a path issue?? Not sure how I could troubleshoot this. Running version 0.68.3 locally.

What does this mean? It’s difficult to troubleshoot an undefined problem. :slightly_smiling_face:

Also, it looks like you are grouping your posts by year. If true, why not use Hugo’s grouping capabilities instead?

Apologies if I was not clear enough. I am not getting an error when Hugo creates the sites but getting discrepancies between how the page gets compiled locally when I run hugo server -D compared to when I deploy to a remote server. I have the website in two locations, one on Netlify ( and one on Cloudlflare (
I really don’t know how to be more specific than that.
The documentation about updating themes seems really sparse and if everything fails then will have to re-create the whole page all over again.

What are the discrepancies?

Do you mean this is not working ?? - Archive - Martin's Blog

The issue seems to affect all pages I generate. The html output produced via local build compared to Netlify is completely different. I am suspecting this might not be a Hugo issue after all.

For example this page

The HTML is fine. And fotr example the embedded Youtube video is rendered correctly.
However once it gets deployed on Netlify or Cloudflare the html gets changed. Its not aligned and for rxample the Youtube link looses the “https:”

Anyone else seeing this issue?

Please post your netlify.toml. If you have none :wink: then there is your issue. Netlify’s default Hugo is some old version. You need to at least at a current version. Then probably some other settings.

On that docu-page there is also a link to their Hugo specific explanations (in the left side navigation).

Yes. But I think the issue might be related to a wider html rendering issue.

Unless specifically configured Netlify uses v0.54.0.

https was added to the URL generated by the embedded youtube shortcode in v0.58.0.

Please, make sure you are running the same version of Hugo in all locations before assuming there is a “wider html rendering issue.”

You are right. Found out via the Netlify support that Netlify builds default to Hugo v0.54.0 that dates back to 1 Feb 2019.
Forcing the version sorted out the issue including the Archive and the deformed Youtube link.
To answer a previous reply, netlify.toml is not a requirement but you can add settings in it as per this documentation page Build environment variables | Netlify Docs

Another good source is Hugo on Netlify | Netlify Docs that is specifically for Hugo

The hugo version variable and other variables can also be added through the Netlify web UI.
Screenshot at 2021-06-28 14-27-34

As per having the same hugo version on all hardware this is slightly tricky as I run Ubuntu 20.04.2 LTS on one and Arch Linux on the other. The package on arch is stuck in 0.82 despite it saying it should be 0.84.
PS And when i meant a “wider html rendering issue” I meant on my page. :slightly_smiling_face:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.