Adding an image to a post with the Universal theme

Testing the Universal theme for Hugo from GitHub - devcows/hugo-universal-theme: Port of the Universal theme to Hugo. Have added a few posts as .md files and the content is fine locally and on a test website.Yet I cannot get an image to display. The image reference in the .md file is

![Post title](/img/imagefilename.jpg "Photo by ********* from Pexels")

The image for the post is in /mysite/themes/hugo-universal-theme/static/img and /mysite/themes/hugo-universal-theme/exampleSite/static/img , yet the image won’t display. I have searched through all the .md files in the theme for the string ‘image’ and read up on images, and they should be in /static/img . As one of those paths didn’t work, I added the image to the other. No doubt there is no need to have the image in the …/exampleSite/… path as that is all created with a hugo server command.

I can see how the theme uses banners, but a banner is like a thumbnail for a post. This is an image within a post.

What is the baseURL in your site configuration?

1 Like

baseurl = “https://example.org

Now the image appears ?? I did see one post in the issues for this theme about the image being too big and didn’t show though and was going to look at that. I don’t know why it wasn’t and now it is ?? Hugo does pickup any changes when I’m running the server, so it is not cache.

Anyway, the image is now appearing, but it is massive. The size is 6.6 Mb, width 4000 and height 6000. Once I reduce the size, where should the attributes for the image go, or does hugo just work it out and create the necessary html (img) code ?

I have seen image specs in the top of the .md files, but I think that is only for the banner/thumbnail side of things, not when there are images in the content of the actual post.

@jmooring thanks for your help.

There doesn’t seem to be a method to define within the .td post, to centre an image. One solution via CSS at html - Using Markdown, how do I center an image and its caption? - Stack Overflow