htmlmarkdownhugohugo-shortcode

With Hugo, can we use Markdown file in a HTML file?


I have index.html and I want to have its content as MD files content.md.

There are also blurt answer on how to do it such as this one but they throw an error as well it doesn't feel right since the framework been evolved since 2016.

Reading the docs do not help since they all are talking for the end-user and not to someone who try to create the template themselves. Creating posts and such are already creating in MD but I want to inject MD to HTML page.


Solution

  • This is achievable using built-in tools. Partial will streamline the file and markdown would convert the md content to HTML.

    {{ partial "content.md" | markdownify }}