I’ve been experimenting with syndicating parts of my blog to dev.to for extra reach. Since dev.to expects Markdown with Jekyll-style front matter, I put together a quick and dirty solution using Hugo’s output formats to solve two problems:
- Render links as absolute (and use the extra link logic I use for various things)
- Render code blocks correctly
My solution was basically to:
- Define a
jekylloutput format (text/markdown) alongside the default HTML. - Add a simple
single.jekyll.mdtemplate with front matter +{{ .Content }}. - Use Hugo’s render hooks (
render-codeblock,render-link) to:- Re-emit fenced code blocks as triple backticks.
- Ensure all links are absolute.
With that, every hugo build now gives me:
public/post/jekyll/index.md which I can paste straight into dev.to
Limitations: only some elements have render hooks, so the Markdown output still mixes in HTML. That’s fine for Forem, which renders both.
I have also not done anything about images (largely because I don’t really use them much)
Full write-up with config + templates
Would love any thoughts / suggestions / feedback
I love how flexible and easy hugo is to work with.
Thanks ![]()