diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 062d896..703866a 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -50,7 +50,7 @@
{{/* - .Content - */}} -{{- partial "replace-content-with-keywords-links.html" . -}} +{{- partial "replace-content.html" . -}} {{- partial "tags.html" . -}}
diff --git a/layouts/books/single.html b/layouts/books/single.html index b99a8ef..b941bdc 100644 --- a/layouts/books/single.html +++ b/layouts/books/single.html @@ -40,7 +40,10 @@
{{- partial "author-reader.html" . -}} - {{- .Content -}} + + {{/* - .Content - */}} +{{- partial "replace-content.html" . -}} + {{- partial "episodes-list.html" . -}} {{- partial "section.html" . -}} {{- partial "tags.html" . -}} diff --git a/layouts/partials/replace-content-with-keywords-links.html b/layouts/partials/replace-content.html similarity index 61% rename from layouts/partials/replace-content-with-keywords-links.html rename to layouts/partials/replace-content.html index feb8a9b..15e5446 100644 --- a/layouts/partials/replace-content-with-keywords-links.html +++ b/layouts/partials/replace-content.html @@ -1,4 +1,4 @@ -{{/* this is used to replace the keywords in content with links +{{/* this is used to replace the keywords & characters in content, to implement internal links and for better typesetting reference: - https://discourse.gohugo.io/t/replace-function-when-applied-to-content-displays-html-tags-instead-of-rendering-them/37717 @@ -30,4 +30,22 @@ https://gohugo.io/templates/rss/#reference-your-rss-feed-in-head {{/* end - range the CSV keywords */}} {{ end }} +{{*/ start the better-typesetting replacement */}} + +{{ $url := "static/csv/better-typesetting.csv" }} +{{ $sep := "," }} + +{{/* start - range the CSV keywords */}} +{{ range $i, $r := getCSV $sep $url }} + +{{ $old := index $r 0 }} +{{ $new := index $r 1 }} + +{{- if (strings.Contains $Content $old) -}} +{{ $Content = replace $Content $old $new }} +{{ end }} + +{{/* end - range the CSV keywords */}} +{{ end }} + {{ $Content | safeHTML }} \ No newline at end of file diff --git a/layouts/podcast/single.html b/layouts/podcast/single.html index c327d76..5b91a91 100644 --- a/layouts/podcast/single.html +++ b/layouts/podcast/single.html @@ -40,7 +40,10 @@
{{- partial "author-reader.html" . -}} - {{- .Content -}} + + {{/* - .Content - */}} +{{- partial "replace-content.html" . -}} + {{- partial "audio-player.html" . -}} {{- partial "episodes-list.html" . -}} {{- partial "tags.html" . -}} diff --git a/layouts/readers/single.html b/layouts/readers/single.html index cd8e2d6..b065aa0 100644 --- a/layouts/readers/single.html +++ b/layouts/readers/single.html @@ -43,7 +43,7 @@
{{/* - .Content - */}} -{{- partial "replace-content-with-keywords-links.html" . -}} +{{- partial "replace-content.html" . -}} {{- partial "list-reader-books.html" . -}} {{- partial "list-reader-episodes.html" . -}} diff --git a/static/csv/better-typesetting.csv b/static/csv/better-typesetting.csv new file mode 100644 index 0000000..99e0363 --- /dev/null +++ b/static/csv/better-typesetting.csv @@ -0,0 +1 @@ +·,・ \ No newline at end of file