Including one md file into another

Let’s say I am creating a new markdown file. I have two paragraphs. I would like to embed an already existing md file in between two paragraphs. I would also want to render the embedded file with a custom Content View Template.

I would be grateful if anybody could explain how to do it.

This can be done by using a shortcode and then grabbing the other markdown file as a page resource.

I don’t know how to do this. Maybe others can help you there.

thanks.

I know how to render through pages, but how to grab a specific md file?

You can use

{{ .Page.Resources.GetMatch "*your-page*" }}

Also see the docs on Page Resources https://gohugo.io/content-management/page-resources/#methods

1 Like