Using the Output Format, I am trying to get Hugo to produce a plain text version of my posts.
Say I have a post that is titled hello-world.md. Hugo creates the folder “posts/hello-world” with the file index.html. I also want there to be a file in the same directory called index.txt which would be the plain text version of index.html.
in my hugo.toml
EDIT: I am on a mission to inspire people to use more plain text on the Internet and encourage them to use Lynx. I miss the internet of the 90’s.
[module]
[module.hugoVersion]
extended = false
min = "0.116.0"
[mediaTypes]
[mediaTypes.'text/plain']
suffix = 'txt'
[outputFormats]
[outputFormats.PlainText]
mediaType = 'text/plain'
isPlainText = true
baseName = 'index'
[outputs]
home = ['html']
section = ['html']
page = ['html', 'plaintext']
I have a file in my theme, layouts/_default/single.plaintext.txt as well as single.txt (just for good measure).
For both of this files I have in them:
{{ .Title }}
{{ strings.Repeat "=" (len .Title) }}
{{ .Content | plainify }}
According to the documentation it would seem that I have done all I need to do and should just be able to render the plain text files. Yet when I start hugo server -D , I get this warning:
Start building sites …
hugo v0.144.2-098c68fd18f48031a7145bedab30cbaede48858f+extended linux/amd64 BuildDate=2025-02-19T12:17:04Z VendorInfo=gohugoio
WARN found no layout file for "plaintext" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
| EN
-------------------+-----
Pages | 15
Paginator pages | 0
Non-page files | 1
Static files | 2
Processed images | 0
Aliases | 0
Cleaned | 0
Any help would be greatly appreciated.
Thanks