From 15cb3e0a820727e5f77f8bec9327ae51380970f9 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 15 Jan 2024 12:42:20 -0600 Subject: [PATCH 01/10] rss: use full text instead of summary --- layouts/_default/rss.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 6a7f770..5c2d88e 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -40,7 +40,7 @@ {{ range (.GetTerms "tags") }} {{ .LinkTitle }}{{ end }} {{ .Permalink }} - {{ .Summary | plainify }} + {{- .Content | html -}} {{ end }} From ccf395c95b5cf0ce51b30b4d10055675829a147e Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 15 Jan 2024 12:51:22 -0600 Subject: [PATCH 02/10] rss: highlight xml --- torchlight.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/torchlight.config.js b/torchlight.config.js index 81c3bea..35265ff 100644 --- a/torchlight.config.js +++ b/torchlight.config.js @@ -50,7 +50,8 @@ module.exports = { // Globs to include when looking for files to highlight. includeGlobs: [ '**/*.htm', - '**/*.html' + '**/*.html', + '**/feed.xml' ], // String patterns to ignore (not globs). The entire file From 71b61c700db3d8594eafbaa33794fcee0f2b6ca0 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 15 Jan 2024 12:57:07 -0600 Subject: [PATCH 03/10] Revert "rss: highlight xml" This reverts commit ccf395c95b5cf0ce51b30b4d10055675829a147e. --- torchlight.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/torchlight.config.js b/torchlight.config.js index 35265ff..81c3bea 100644 --- a/torchlight.config.js +++ b/torchlight.config.js @@ -50,8 +50,7 @@ module.exports = { // Globs to include when looking for files to highlight. includeGlobs: [ '**/*.htm', - '**/*.html', - '**/feed.xml' + '**/*.html' ], // String patterns to ignore (not globs). The entire file From de7579064727e30c6e12197dae9fff2aef1a46d1 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 15 Jan 2024 13:09:20 -0600 Subject: [PATCH 04/10] rss: encode content in description --- layouts/_default/rss.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 5c2d88e..8420e36 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -13,6 +13,7 @@ {{- printf "" | safeHTML }} {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} @@ -40,7 +41,8 @@ {{ range (.GetTerms "tags") }} {{ .LinkTitle }}{{ end }} {{ .Permalink }} - {{- .Content | html -}} + {{ " + {{ " {{ end }} From c8f4a80c27528ba7e277d37aad890781f02d1c59 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 15 Jan 2024 13:23:34 -0600 Subject: [PATCH 05/10] rss: fix image embeds --- layouts/_default/rss.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 8420e36..e44d174 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -42,7 +42,7 @@ {{ .LinkTitle }}{{ end }} {{ .Permalink }} {{ " - {{ " + {{ " {{ end }} From d86964f33fce2b839c4fd38e24a351cf5518044f Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 15 Jan 2024 13:39:27 -0600 Subject: [PATCH 06/10] rss: alternate approach to image embeds --- layouts/_default/rss.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index e44d174..e1f9961 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -10,7 +10,7 @@ {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} {{- end -}} -{{- printf "" | safeHTML }} + {{ .LinkTitle }}{{ end }} {{ .Permalink }} - {{ " - {{ " + {{- $content := replaceRE "a href=\"(#.*?)\"" (printf "%s%s%s" "a href=\"" .Permalink "$1\"") .Content -}} + {{- $content = replaceRE "img src=\"(.*?)\"" (printf "%s%s%s" "img src=\"" .Permalink "$1\"") $content -}} + {{ $content | html }} {{ end }} From 41843eba32801f4ff501b6a63adbc92037f03539 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 15 Jan 2024 13:53:52 -0600 Subject: [PATCH 07/10] rss: don't minify whitespace in xml --- config/_default/hugo.toml | 27 +++++++++++++++++++++++++++ layouts/_default/rss.xml | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml index c6155e5..ef02686 100644 --- a/config/_default/hugo.toml +++ b/config/_default/hugo.toml @@ -60,3 +60,30 @@ enableInlineShortcodes = true tag = "tags" series = "series" +# Copied from https://gohugo.io/getting-started/configuration/#configure-minify +# Only change made is xml keepWhitespace = true +[minify] + disableCSS = false + disableHTML = false + disableJS = false + disableJSON = false + disableSVG = false + disableXML = false + minifyOutput = false + [minify.tdewolff] + [minify.tdewolff.css] + decimals = -1 + keepCSS2 = true + [minify.tdewolff.html] + keepConditionalComments = true + keepDefaultAttrVals = true + keepDocumentTags = true + keepEndTags = true + keepQuotes = false + keepWhitespace = false + [minify.tdewolff.js] + [minify.tdewolff.json] + [minify.tdewolff.svg] + decimals = -1 + [minify.tdewolff.xml] + keepWhitespace = true \ No newline at end of file diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index e1f9961..198a490 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -10,7 +10,7 @@ {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} {{- end -}} - +{{- printf "" | safeHTML }} Date: Mon, 15 Jan 2024 13:59:40 -0600 Subject: [PATCH 08/10] Revert "rss: don't minify whitespace in xml" This reverts commit 41843eba32801f4ff501b6a63adbc92037f03539. --- config/_default/hugo.toml | 27 --------------------------- layouts/_default/rss.xml | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml index ef02686..c6155e5 100644 --- a/config/_default/hugo.toml +++ b/config/_default/hugo.toml @@ -60,30 +60,3 @@ enableInlineShortcodes = true tag = "tags" series = "series" -# Copied from https://gohugo.io/getting-started/configuration/#configure-minify -# Only change made is xml keepWhitespace = true -[minify] - disableCSS = false - disableHTML = false - disableJS = false - disableJSON = false - disableSVG = false - disableXML = false - minifyOutput = false - [minify.tdewolff] - [minify.tdewolff.css] - decimals = -1 - keepCSS2 = true - [minify.tdewolff.html] - keepConditionalComments = true - keepDefaultAttrVals = true - keepDocumentTags = true - keepEndTags = true - keepQuotes = false - keepWhitespace = false - [minify.tdewolff.js] - [minify.tdewolff.json] - [minify.tdewolff.svg] - decimals = -1 - [minify.tdewolff.xml] - keepWhitespace = true \ No newline at end of file diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 198a490..e1f9961 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -10,7 +10,7 @@ {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} {{- end -}} -{{- printf "" | safeHTML }} + Date: Mon, 15 Jan 2024 14:00:28 -0600 Subject: [PATCH 09/10] enable minify in config, don't minify xml --- build.sh | 2 +- config/_default/hugo.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 3d63676..78499bd 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Quick script to run local builds source .env -hugo --minify --environment local -D +hugo --environment local -D npx torchlight python3 -m http.server --directory public 1313 diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml index c6155e5..7d181e6 100644 --- a/config/_default/hugo.toml +++ b/config/_default/hugo.toml @@ -60,3 +60,6 @@ enableInlineShortcodes = true tag = "tags" series = "series" +[minify] + disableXML = true + minifyOutput = true \ No newline at end of file From f51fc36b6dbee2f4237b439b4122089289dffb2a Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 15 Jan 2024 14:04:59 -0600 Subject: [PATCH 10/10] remove minify from netlify config --- netlify.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netlify.toml b/netlify.toml index 601059d..d62d2ed 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,14 +6,14 @@ [context.production] command = """ - hugo --minify + hugo npm i @torchlight-api/torchlight-cli npx torchlight """ [context.preview] command = """ - hugo --minify --environment preview + hugo --environment preview npm i @torchlight-api/torchlight-cli npx torchlight """ @@ -24,7 +24,7 @@ [context.drafts] command = """ - hugo --minify --environment drafts -D + hugo --environment drafts -D npm i @torchlight-api/torchlight-cli npx torchlight """