Skip to content
Snippets Groups Projects
Commit ed53a75f authored by Kaushal Modi's avatar Kaushal Modi
Browse files

TXT: output format for plain text

parent 5f8bea47
Branches
No related tags found
No related merge requests found
......@@ -17,6 +17,20 @@ enableGitInfo = true
[markup.goldmark.renderer]
unsafe = true
[mediaTypes."application/text"]
suffixes = ["txt"]
[outputFormats.TXT]
mediaType = "application/text"
baseName = "index" # generated file = <baseName>.<mediaType."application/text".suffixes[0]> = index.txt
isPlainText = true
[outputs]
home = ["HTML", "TXT"]
section = ["HTML"]
taxonomy = ["HTML"]
term = ["HTML"]
page = ["HTML", "TXT"]
[Params]
subTitle = "Minimum working examples for testing out Hugo issues and features"
mainSections = ["posts"]
......
......@@ -4,7 +4,8 @@
* Hello
:PROPERTIES:
:EXPORT_FILE_NAME: hello
:EXPORT_HUGO_BUNDLE: hello
:EXPORT_FILE_NAME: index
:EXPORT_HUGO_CUSTOM_FRONT_MATTER: :branch plain-text-output
:END:
[[https://discourse.gohugo.io/t/having-trouble-with-plain-text-output/37365/][Reference]]
......
File moved
......@@ -8,29 +8,10 @@
</blockquote>
{{ end }}
<h2 style="color: green;">Custom</h2>
{{ with .RawContent }}
{{ $content := . }}
{{ $content = replaceRE "\\s*\\{#[^}]+\\}" "" $content }}
{{ $content = replaceRE "\\n" "<br/>" $content }}
{{ $content | safeHTML }}
{{ end }}
<h2 style="color: green;">Content</h2>
{{ with .Content }}
{{ . }}
{{ end }}
<h2 style="color: green;">Plain</h2>
{{ with .Plain }}
{{ . }}
{{ end }}
<h2 style="color: green;">RawContent</h2>
{{ with .RawContent }}
{{ . }}
{{ end }}
{{ end }}
{{ define "footer" }}
......
{{ with .RawContent }}
{{ $content := . }}
{{ $content = replaceRE "\\s*\\{#[^}]+\\}" "" $content }}
{{ $content }}
{{ end }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment