{{/* 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 - https://gohugo.io/templates/data-templates/ - https://github.com/gohugoio/hugo/issues/1150 */}} {{ $Content := .Content }} {{ $url := "static/csv/keywords-links.csv" }} {{ $sep := "," }} {{/* start - range the CSV keywords */}} {{ range $i, $r := getCSV $sep $url }} {{ $keyword := index $r 0 }} {{ $link := index $r 1 }} {{/* reference: https://discourse.gohugo.io/t/hugo-templating-quotes-within-quotes/11661/4 https://gohugo.io/templates/rss/#reference-your-rss-feed-in-head */}} {{- $newWithLink := printf `%s` $link $keyword -}} {{- if (strings.Contains $Content $keyword) -}} {{ $Content = replace $Content $keyword $newWithLink }} {{ end }} {{/* 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 }}