and when I add the homepage index.html it is fine. however when I add other single pages, it cannot see the css from the folder it creates for the new post. ie in
/post
the original css path in the template is css/style.css, but that is obviously wrong for the new post.
I have tried …/css/style.css but that isn’t finding it.
I think the problem is that the template is calling the js as well as the css - but I can’t work out what the path should be, so it isn’t displaying
I have tried /css/style.css and …/style.css and …/…/style.css but none of them seem to work. Maybe I’ll have to abandon this template! any html in the main /public folder seems to work when …/public/css is used, but nothing seems to work when there is an index.html file in a subdirectory like /post
public shouldn’t be in your path at all. If you have your css/ stowed in the static/ directory, Hugo will copy it into public/ automatically. But public is the “root” of your site - it’s not part of it.
Have you tried {{ .Site.BaseURL }}js/query.min.js in your template?
By a process of elimination, I have been able to work out that it is the js init.js which is causing the problem - it is what is making the site dynamic so determining which css to load.
I have been able to load it hosting the js and css elsewhere, but I will try your path suggestion…
it says Error while rendering homepage: template: index.html:14:23: executing “index.html” at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo
I have set the baseurl as file///path/to in config but I’m not sure what this should be in this instance.
hum. well I found that one of the problems was that canonifyurls was set to true. So Site.BaseUrl works now, but obviously I need to put in something else other than example.com…
Great, I have it working now. unfortunately I don’t think this will work in the js, but finally some progress! thanks for your help.
Any ideas how I can get the css and js files to path back to root? I have tried to use …/ as they are not going to be moving, but that doesn’t seem to have the desired effect.