devcows / hugo-universal-theme

Universal theme for Hugo, it stands out with its clean design and elegant typography.
https://devcows.github.io/hugo-universal-theme
MIT License
808 stars 573 forks source link

[fix] responsive image support for Markdown Post #396

Open Chen-Gary opened 11 months ago

Chen-Gary commented 11 months ago

If we add an image to a post without the right sidebar (e.g. the FAQ page in the demo), the image will not resize automatically as the window size changes.

image

I fix this by adding a Hugo "Markdown render hooks" for markdown image. Reference: https://gohugo.io/templates/render-hooks/#image-markdown-example

The image will render correctly with this file added.

image

Note: Posts with the right sidebar do render images correctly, even without this render hook (e.g. this post in demo).