Re: Remove Markdown Syntax Images from .Content

Unfortunately I can’t comment on the old thread.

The linked post below talks about adding {{ .Content | replaceRE "<img[^>]*>" "" | safeHTML }}. Could someone tell me where exactly to add? Perhaps even with an example?

https://discourse.gohugo.io/t/remove-markdown-syntax-images-from-content/9948

It would be awesome if someone with admin rights could add more information to the original post, so it becomes more helpful for everyone in the future.

You’ll have to override your theme’s template for the corresponding layout, most likely single.

Check your theme’s GitHub source, and locate the single.html layout template. Copy the contents and place it in your website’s root at the same path, e.g. website/layouts/partials/_default/single.html.

In this new file replace the line containing .Content with the invocation in the post.

That should do it.

I’ve deleted the original post because it is no longer relevant or correct.