Question about using the mmark include file function (solved)

Should the local site view convert the included file (a markdown file) to HTML and include it where the link has been inserted, or is this only seen in on the converted site?

At the moment the link file seems to be getting ignored in local view, and our publishing pipeline involves merging to a GitHub repo and then using Buddy to push to the live site.

What do you mean by “local view”?

Sorry, http://localhost:1313/ after running hugo server.

OK; the server should (for this purpose) behave exactly like the “full Hugo build”. I have ittle experience with MMark, so you may wait for other to chime in.

A bit of an update. The file to be included ( is getting transformed into HTML, but is not being appended to the file it is being linked from (test.mmark). I have saved in the same location as test.mmark. I can see the HTML version of test.mmark if I go directly to localhost:1313/mypath/test-include/.

My link code is {{}}

If you do not want Hugo to generate a page for the included file, then put it outside the content folder. Create an include folder. For Windows it should look something like this.


Hi @Mikhail. I want Hugo to include the content of to be generated and appear where I put the link in the mmark file. At the moment that doesn’t happen. No matter where I place I get the following when building drafts:

2017/10/04 09:37:31 mmark: failed: /docs/include/': open /docs/include/ no such file or directory

Other files (graphics) are picked up ok from this location and I’ve checked the names of my files. Even with the file in the same directory as the mmark file refuses to include it. Strange!

I just tested this code and it works without errors. {{C:\Users\Rabota\Desktop\url.txt}}

Hugo 0.25.1, Windows 10

Perhaps you need to change the path to the file, I do not know exactly how it should look in Linux.

Hi @Mikhail It worked when I added this path - /Users/marksouthee/tyk-docs/tyk-docs/static/include/
This is totally different to how I link to images etc, hence my confusion.

Thanks for your help

Perhaps Mmark takes the path /docs/ relative to the current folder.

Hi @Mikhail. that’s possible. This is from the Mmark syntax

“Including other files can done be with {{filename}}, if the path of filename is not absolute, the filename is taken relative to working directory of the Mmark process.”

I’m assuming that the working directory of the Mmark process is the directory the .mmark file is located within my docs structure?

Yes, I think so.

Just want to warn that the files placed in the static folder are copied to the server unchanged. It’s a bad idea to place includes in the static folder.


Thanks for that. The following relative path worked for me. ./static/include/ The include file ( a .md file) is getting transformed ok, so the location within static seems ok?

All files from the static folder will be available online. will be available at url http://localhost:1313/include/ Do you really want this?

Hi @Mikhail, to be honest I doubt anyone will find it and it doesn’t get included in any search results.