HUGO

Is it easy to *also* serve .md files next to the .html?

Something I’ve seen a couple of times on people’s personal sites (which I really like) is that if a post is at www.site.com/path/to/post.html, they also serve www.site.com/path/to/post.md.

Is this something Hugo supports? It’s probably easy enough to get something bare-bones with a post-build bash script, but something baked into Hugo could give us nice possibilities like the ability to automatically strip front matter or expand our {{< ref "post-name" >}} links into actual URLs.

I couldn’t find any documentation about this, probably because it’s extremely hard to Google for anything like “serve markdown alongside html hugo” when most questions about Hugo seem to be either about Markdown or about serving!

To achieve what you want you would need to create a Custom Output Format for Markdown.

See:

1 Like

Thanks - exactly what I was looking for!

Can I ignorantly ask where you saw this? It’s weird to do this. It’s easy to do this with custom output formats, but somehow it’s weird to “give away” your content that easily. The only reason why someone would want to have your content in a markdown format would be to re-use it on their own sites, wouldn’t it?

It’s no weirder than people making their blogs public on GitHub, of which there are any number (GitHub - KyleAMathews/blog: my blog!, GitHub - Ocramius/ocramius.github.com: Coding thoughts and ideas by Ocramius, just from the first page of Google hits for “github blogs”). Some people are just happy to give things away. I myself have eleven MIT-licensed GitHub repositories.

I can’t remember precisely where I saw this - certainly within the last week I’ve seen one, and I find one every so often throughout the years. My browser history is being unhelpful at the moment, I’m afraid.

Actually, the most prominent example is probably Gwern Branwen, at gwern.net. His is an extremely popular site. See, for example, https://www.gwern.net/About.md .

1 Like

The forum software thought that your post above is spam and I admit that I was momentarily confused until I saw the questions by @davidsneighbour

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.