Closed iGormilhit closed 5 years ago
Ok, I got it, sorry for the noise.
I was checking the build version on a Netlify preview, and so the base URL isn't the right one. I've change my layouts/partials/brand.html
code to this: <img src="{{ .Site.BaseURL | relURL }}img/logo.svg" ...
, and the preview is now working as I expect.
In the layouts files, I've seen that to build an URL to get the
css
or another static resource, the code is{{ .SiteBaseURL }}css/style.css
, and that the file is instatic/css/style.css
.So, I have a
static
folder in my hugo directory, with a sub folderimg
that contains mylogo.svg
. And in thelayouts/partials/brand.html
, I have this code:<img src="{{ .Site.BaseURL }}img/logo.svg" ...
, which works fine withhugo server
.However, when trying to deploy through Netlify, the URL to
style.css
andlogo.svg
get a 404 error. The path arehttps://[my-domain]/css/style.css
orhttps://[my-domain]/img/logo.svg
.So, I'm wondering how the resolution to the
static
directory works.