You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the bottom of each page on the website there is an edit this page link. The link is generated automatically by the hugo book theme that we use. Specifically, the link is generated in the footer layout, as follows:
For these links to work with our site, {{ .Site.Params.contentDir | default "content" }} should return content. staticDir is a Hugo defined variable. In a standard Hugo configuration (at least prior to v0.56) it is set to 'content' by default (see docs).
However, in our case .Site.Params.contentDir seems to return an empty string, which means that the snippet returns an empty string and the edit links do not work (they point to the wrong URL). I believe this is because we are using Hugo ≥0.56 and "mounts", which makes the default parameters obsolete. I believe this is also what's pointed out in the Hugo docs, albeit not very clearly:
When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it.
I've tried to add a mount for 'content' but it did not affect the url that was generated by the snippet. I think it's because the snippet explicitly asks for the .Site.Params.contentDir parameter and doesn't care about the mounts.
I eventually got the links to work by setting contentDir = 'content' in our site's config.toml
This works, but it goes against the recommendations in the Hugo docs:
you should not have both: if you add a mounts section you should remove the old staticDir etc. settings
So we shouldn't be using mounts and contentDir site params in the same configuration. It appears to work for our purposes and it will probably continue to work unless we update Hugo or the theme. The reason I'm leaving this issue here is that if something breaks, people know where to look. Or perhaps, someone wants to try to configure this "the proper way" or raise an issue with the theme.
The text was updated successfully, but these errors were encountered:
At the bottom of each page on the website there is an edit this page link. The link is generated automatically by the hugo book theme that we use. Specifically, the link is generated in the footer layout, as follows:
For these links to work with our site,
{{ .Site.Params.contentDir | default "content" }}
should returncontent
.staticDir
is a Hugo defined variable. In a standard Hugo configuration (at least prior to v0.56) it is set to 'content' by default (see docs).However, in our case
.Site.Params.contentDir
seems to return an empty string, which means that the snippet returns an empty string and the edit links do not work (they point to the wrong URL). I believe this is because we are using Hugo ≥0.56 and "mounts", which makes the default parameters obsolete. I believe this is also what's pointed out in the Hugo docs, albeit not very clearly:I've tried to add a mount for 'content' but it did not affect the url that was generated by the snippet. I think it's because the snippet explicitly asks for the
.Site.Params.contentDir
parameter and doesn't care about the mounts.I eventually got the links to work by setting
contentDir = 'content'
in our site'sconfig.toml
This works, but it goes against the recommendations in the Hugo docs:
So we shouldn't be using mounts and
contentDir
site params in the same configuration. It appears to work for our purposes and it will probably continue to work unless we update Hugo or the theme. The reason I'm leaving this issue here is that if something breaks, people know where to look. Or perhaps, someone wants to try to configure this "the proper way" or raise an issue with the theme.The text was updated successfully, but these errors were encountered: