GreenMatt GreenMatt - 11 months ago 100
Markdown Question

How can another file be Included in a Hugo/Markdown page?

Recently the re-development of a web site was given to me. The re-worked site is to use be done in Markdown and run through the Hugo static site generator. I'm out-of-date with web site development and unfamiliar with Hugo.

Is there a way to include other files in a Markdown web page processed through Hugo? If so, how? Unless I've missed something, this isn't addressed in the Hugo docs.

With HTML and some servers (Apache, at least) you can do something like:

Some content
<!--#include virtual="name_of_first_file_to_include" -->
More content
<!--#include virtual="name_of_second_file_to_include" -->
Still more content

I've tried creating a template page which puts stuff like "Some content" and "More content" into the template and then the included stuff in my .md file which gets "included" via {{ .Content }} in the template. However, 1) That seems like the wrong way to use a template. 2) I've not figured out a way to bring in more files if I need them.

bep bep
Answer Source

For content files there are two options:

  1. Shortcodes. Powerful and documented.
  2. Use mmark as the markdown rendering engine with its include feature. Rename the content files to "*.mmark". See

I am the maintainer of Hugo.