Raw Markdown Pages
I added some configuration to this Hugo site allow access to the raw Markdown versions of posts.
This enables you to hit URLs such as this to get the raw markdown of this post.
You can find the same Raw
link at the bottom of all my posts as well.
This addition was made possible with the follow config changes
[outputs]# ...page = ["HTML", "Markdown"]
[mediaTypes][mediaTypes."text/markdown"]suffixes = ["md"]
[outputFormats][outputFormats.Markdown]mediaType = "text/markdown"isPlainText = trueisHTML = falsebaseName = "index"rel = "alternate"
which rebuilds the original post markdown according to the definition in layouts/_default/single.md
{{ $params := slice }}{{- range $key, $value := .Params -}}{{- if $value -}}{{ $params = $params | append (printf "%s: %v" $key $value) }}{{- end -}}{{- end -}}
---
{{ range $param := $params }}{{ $param }}{{ end }}---{{ .RawContent }}
With everything setup, I ran hugo
and validated that the .md
files were correctly created in the public folder.
For example:
❯ tree public/til/hugo/raw-markdown-pagespublic/til/hugo/raw-markdown-pages├── images│ └── raw-markdown-pages.png├── index.html├── index.md├── raw-markdown-pages│ ├── index.html│ └── index.md└── raw-markdown-pages.png
This approach also allows me to easily view the content from my site via curl
Recommended
Adding an llms.txt file to Hugo
Today, I set out to add an llms.txt to this site. I've made a few similar additions in the past with raw post markdown files and a search...
Custom Markdown rendering
Markdown is useful tool -- these blog posts are written in it. I like Markdown because once you learn it, it feels invisible. It is minimal and...
Hugo Social Image Previews
I've started posting more on Bluesky and I noticed that articles from my site didn't have social image previews 😔