I’m trying to introduce page specific CSS to my site using page resources. It seems like a simple concept but I can’t get it working and I’m not sure why, can somebody help please?
My file structure is:
content
--- about
--- index.html
--- page.css
Simple, one html file and accompanying CSS.
In my css.html partial (the default Hugo one) I’ve added this
{{- with resources.Get "page.css" }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{- end }}
But there’s no sign of the link appearing, which I’m guessing means there’s something wrong and it’s not finding page.css.
from the symptoms, and that default statement, I also suppose your baseof and head templates are quite default.
So I would suppose the partial is called using partialCached, which means called once for the whole site and the page order order is non deterministic… It may work at one run and fails the next time.
If so the main problem is in the code around - that’s why we usually like it to have the full context instead of some snippets (guess that’s where @tyco want’s to point you.)