Having searched all day for an answer to my problem and trying to work out the path for displaying images in static folder, just had to sign up here and get some support!
Oh no that was just my trying different paths to see what would work. Nothing worked. I just haven’t changed back to reflect my local dir where it is just /images/hatman.jpg SORRY
Looking at the output, the issue is that the figure shortcode creates this html
which doesn’t work because your site is hosted in a subdirectory. What you need it to say is <img src="/50-50/images/hatman.jpg"> or <img src="https://angkorhats.github.io/50-50/images/hatman.jpg">
I think if you include the setting canonifyURLs=true in your config.toml it should convert all relative URLs (such as from your figure shortcode) to absolute URLs, using the value from baseURL.
Now I have tried all of the above and nothing works.
The only documentation I can find is about two separate language folders in static but
nothing regarding my problem here.
It is hard to believe no-one else had had the same problem I am having and that there isn’t a simple solution. I understand paths very well but this I cannot comprehend.
Yes - this is new to me to as none of my sites are hosted in a subdirectory.
I found something interesting by searching the forum
So I think you need to have in config.toml
canonifyURLs = true
relativeURLs = true
And then rebuild your site.
I think this will mean that the resulting HTML for your images will be something like
<figure>
<img src="../images/hatman.jpg" />
which will do the trick.
I can see that in your last push to GitHub you’ve decided to put the full URL for images. That will work, but will mean your site isn’t transferable, and also will limit some of the nice things you can do with transforming images in the more recent versions of Hugo. And, to me, makes the markdown files more cluttered.
What is so strange is that i rebuilt the site locally and removed the code
canonifyURLs = true
in config.toml
Then as you notice I gave absolute URL in the about section but I gave relative url “/images/bus.jpg”
in the index of post section and BOTH work…I have no idea why!
If I don’t understand why I do not know how to replicate. As it is I do not know how to make one change so have to keep deleting entire repository then create anew.
Now I have a new problem with dates of theme which I must try and search for an answer.
Thanks very much for your help funkydan2 , I guess this is an ongoing process and a matter
of trial and error until the most consistent fix is found.
PS: I do not know any other way than creating a subfolder! seems to be only option but that is something else I am sure I can find out from reading documentation.
Yes, you are right, It is a question about git. I don’t delete docs folder each time, I delete public folder.
I need to really follow the HUGO and GITHUB official documentation because I am pretty sure the reason why the images weren’t showing up was because I did not deploy properly! I copy and pasted
the code from GITHUB example code when I re created the repos and all of a sudden the images worked!