From fb0eafd272a6cee9b8f9e380cd028f4edde18298 Mon Sep 17 00:00:00 2001 From: tdro Date: Tue, 16 Aug 2022 02:01:07 -0400 Subject: themes/default/layouts/partials: Add plain text Add plain text version of single. Enhance menu permalink ergonomics. Add href to date menu anchor. --- config.json | 7 ++++++- config.toml | 6 +++++- config.yaml | 4 ++++ themes/default/layouts/_default/single.plain.txt | 1 + .../layouts/partials/meta-context-menu.html | 23 ++++++++++++++++++---- themes/default/layouts/partials/meta-view.html | 13 ++++++------ 6 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 themes/default/layouts/_default/single.plain.txt diff --git a/config.json b/config.json index 938286d..e7948bf 100644 --- a/config.json +++ b/config.json @@ -181,6 +181,10 @@ "baseName": "index", "mediaType": "text/html" }, + "plain": { + "baseName": "index", + "mediaType": "text/plain" + }, "json": { "baseName": "index", "mediaType": "application/json" @@ -248,7 +252,8 @@ "rss" ], "page": [ - "html" + "html", + "plain" ] }, "caches": { diff --git a/config.toml b/config.toml index 5171bd0..99fde46 100644 --- a/config.toml +++ b/config.toml @@ -128,6 +128,10 @@ enableRobotsTXT = true baseName = "index" mediaType = "text/html" + [outputFormats.plain] + baseName = "index" + mediaType = "text/plain" + [outputFormats.json] baseName = "index" mediaType = "application/json" @@ -173,7 +177,7 @@ enableRobotsTXT = true section = ["html", "rss"] taxonomy = ["html", "rss"] term = ["html", "rss"] - page = ["html"] + page = ["html", "plain"] [caches] diff --git a/config.yaml b/config.yaml index 5cdc657..b14283e 100644 --- a/config.yaml +++ b/config.yaml @@ -116,6 +116,9 @@ outputFormats: html: baseName: index mediaType: text/html + plain: + baseName: index + mediaType: text/plain json: baseName: index mediaType: application/json @@ -171,6 +174,7 @@ outputs: - rss page: - html + - plain caches: assets: diff --git a/themes/default/layouts/_default/single.plain.txt b/themes/default/layouts/_default/single.plain.txt new file mode 100644 index 0000000..d110b5e --- /dev/null +++ b/themes/default/layouts/_default/single.plain.txt @@ -0,0 +1 @@ +{{- .Content | plainify | htmlUnescape -}} diff --git a/themes/default/layouts/partials/meta-context-menu.html b/themes/default/layouts/partials/meta-context-menu.html index 7269262..1edf80e 100644 --- a/themes/default/layouts/partials/meta-context-menu.html +++ b/themes/default/layouts/partials/meta-context-menu.html @@ -1,18 +1,33 @@ -{{- $id := delimit (shuffle (seq 1 7)) "" -}} +{{- $id := delimit (shuffle (seq 1 7)) "" -}} +{{- $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}} +{{- $href := print .Site.BaseURL "/" $author.user "/messages/" (path.Base .Permalink) "/" -}} +{{- $plain := print .Site.BaseURL "/" $author.user "/messages/" (path.Base .Permalink) "/index.txt" -}} + +{{- with .Params.feed.self -}} + {{- $href = print $.Site.BaseURL "/" $.Params.feed.self -}} + {{- $plain = print $.Site.BaseURL "/" $.Params.feed.self "/index.txt" -}} +{{- end -}} + {{- partial "meta-markdown.html" . -}} {{- partial "meta-permalink.html" . -}} + + + {{- safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/file-text.svg")) -}} + plaintext + + - + {{- safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/calendar.svg")) -}} - {{ .Date.Local | time.Format "Jan 2 2006" | lower -}} + {{ .Date.Local | time.Format "Jan 2 2006" | lower -}} diff --git a/themes/default/layouts/partials/meta-view.html b/themes/default/layouts/partials/meta-view.html index d76798d..a327f78 100644 --- a/themes/default/layouts/partials/meta-view.html +++ b/themes/default/layouts/partials/meta-view.html @@ -1,14 +1,13 @@ {{- $author := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}} +{{- $href := print .Site.BaseURL "/" $author.user "/messages/" (path.Base .Permalink) "/" -}} + +{{- with .Params.feed.self -}} + {{- $href = print $.Site.BaseURL "/" $.Params.feed.self -}} +{{- end -}} {{- /* This comment removes trailing newlines and white spaces. */ -}} - + {{- safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/external-link.svg")) -}} view {{- /* This comment removes trailing newlines and white spaces. */ -}} -- cgit v1.2.3