From b0fe89402f587633282a030d97fd95368c6e1de5 Mon Sep 17 00:00:00 2001 From: Hans van Luttikhuizen-Ross Date: Fri, 5 Apr 2024 19:18:26 +0200 Subject: [PATCH] Improve RSS feed --- hugo.toml | 87 ++++++++++++++++++---------------- layouts/_default/index.rss.xml | 68 ++++++++++++++++++++++++++ layouts/_default/index.xml | 67 -------------------------- 3 files changed, 113 insertions(+), 109 deletions(-) create mode 100644 layouts/_default/index.rss.xml delete mode 100644 layouts/_default/index.xml diff --git a/hugo.toml b/hugo.toml index ac14d4b..8d5ae15 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1,7 +1,6 @@ baseURL = 'https://hansvl.nl/' languageCode = 'en-uk' -title = 'Hans van Luttikhuizen-Ross' -author = 'Hans van Luttikhuizen-Ross' +title = 'Hans' pluralizelisttitles = false paginate = 10 @@ -16,46 +15,50 @@ CanonifyURLs = true series = "series" tag = "tags" -[Params] - favicon = "favicon.ico" - titleImage = 'images/profile.jpg' - showPrevNextPostNavigation = true - showRecentPostsOnIndex = true - -# Favicons config -# Get your favicons from https://realfavicongenerator.net/ -[Params.favicons] - appleTouchIcon = '/apple-touch-icon.png' - icon32 = '/favicon-32x32.png' - icon16 = '/favicon-16x16.png' - manifest = '/site.webmanifest' - maskIcon = '/safari-pinned-tab.svg' - msApplicationTileColor = '#5bbad5' - themeColor = '#2B2B2B' - -# Umami configuration -# https://umami.is/docs/install -[Params.umami] - enabled = true - websiteId = "88d855a7-4414-40a9-b228-1107ef60aca8" - jsLocation = "https://analytics.umami.is/script.js" - -# Plausible configuration -[Params.plausible] - enabled = false - domain = "hansvl.nl" - jsLocation = "https://plausible.io/js/plausible.js" - -# h-card configuration -# fullName is mandatory -[Params.hcard] - avatar = "images/profile.jpg" - fullName = "Hans van Luttikhuizen-Ross" - nickname = "pindab0ter" - showLocation = true - city = "Arnhem" - region = "Gelderland" - country = "The Netherlands" +[params] + favicon = "favicon.ico" + titleImage = 'images/profile.jpg' + showPrevNextPostNavigation = true + showRecentPostsOnIndex = true + + [params.author] + name = 'Hans van Luttikhuizen-Ross' + email = 'contact@hansvl.nl' + + # Favicons config + # Get your favicons from https://realfavicongenerator.net/ + [params.favicons] + appleTouchIcon = 'apple-touch-icon.png' + icon32 = 'favicon-32x32.png' + icon16 = 'favicon-16x16.png' + manifest = 'site.webmanifest' + maskIcon = 'safari-pinned-tab.svg' + msApplicationTileColor = '#5bbad5' + themeColor = '#2B2B2B' + + # Umami configuration + # https://umami.is/docs/install + [params.umami] + enabled = true + websiteId = "88d855a7-4414-40a9-b228-1107ef60aca8" + jsLocation = "https://analytics.umami.is/script.js" + + # Plausible configuration + [params.plausible] + enabled = false + domain = "hansvl.nl" + jsLocation = "https://plausible.io/js/plausible.js" + + # h-card configuration + # fullName is mandatory + [params.hcard] + avatar = "images/profile.jpg" + fullName = "Hans van Luttikhuizen-Ross" + nickname = "pindab0ter" + showLocation = true + city = "Arnhem" + region = "Gelderland" + country = "The Netherlands" # Social icons to be displayed on the front page [[menu.social]] diff --git a/layouts/_default/index.rss.xml b/layouts/_default/index.rss.xml new file mode 100644 index 0000000..e9e1531 --- /dev/null +++ b/layouts/_default/index.rss.xml @@ -0,0 +1,68 @@ +{{- $baseurl := .Site.BaseURL -}} +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "" | safeHTML }} + + + {{ .Site.Title }} + {{ .Permalink }} + Recent posts on {{ .Site.Title }} + {{ with .Site.LanguageCode }}{{.}}{{end}} + {{ with .Site.Copyright }}{{.}}{{end}} + Software Development + {{ with .Site.Params.favicons.appleTouchIcon }} + + {{ $.Site.BaseURL }}{{ . }} + {{ $.Title }} + {{ $.Permalink }} + + {{ end }} + Hugo -- gohugo.io + {{ with .Site.Params.author.email }}{{.}}{{ with $.Site.Params.author.name }} ({{.}}){{end}}{{end}} + {{ with .Site.Params.author.email }}{{.}}{{ with $.Site.Params.author.name }} ({{.}}){{end}}{{end}} + {{- with .OutputFormats.Get "RSS" -}}{{ printf "" .Permalink .MediaType | safeHTML }}{{- end -}} + {{ range $pages }} + {{ if eq .Type "blog" }} + + {{ .Title }} + {{ .Permalink }} + {{ if not .Date.IsZero }}{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{ if and (not (.Lastmod.IsZero)) (not (eq .Date .Lastmod)) }}{{ .Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{ with .Site.Params.author.name }}{{.}}{{end}} + + {{ $content := .Content }} + + {{ $content = replaceRE `a href="(#.*?)"` (printf "%s%s%s" "a href=\"" .RelPermalink "$1\"") $content }} + {{ $content = replaceRE `a href="^../(.*?)"` (printf "%s%s%s" "a href=\"" .RelPermalink "../$1\"") $content }} + {{ $content = replaceRE `a href="/(.*?)"` (printf "%s%s%s" "a href=\"" $baseurl "$1\"") $content }} + + + {{ $content = replaceRE `(?s:]*?class="link".*?<\/a>)` "" ($content | safeHTML) }} + + + {{- `

+ {{- else if (in .Params.cover.src "http") -}} +

+ {{- end -}} + {{ $content | safeHTML }} + ]]> +
+ +
+ {{ end }} + {{ end }} +
+
\ No newline at end of file diff --git a/layouts/_default/index.xml b/layouts/_default/index.xml deleted file mode 100644 index 4a22afd..0000000 --- a/layouts/_default/index.xml +++ /dev/null @@ -1,67 +0,0 @@ -{{- $baseurl := .Site.BaseURL -}} -{{- $pctx := . -}} -{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} -{{- $pages := slice -}} -{{- if or $.IsHome $.IsSection -}} -{{- $pages = $pctx.RegularPages -}} -{{- else -}} -{{- $pages = $pctx.Pages -}} -{{- end -}} -{{- $limit := .Site.Config.Services.RSS.Limit -}} -{{- if ge $limit 1 -}} -{{- $pages = $pages | first $limit -}} -{{- end -}} -{{- printf "" | safeHTML }} - - - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} - {{ .RelPermalink }} - Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} - Hugo -- gohugo.io{{ with .Site.LanguageCode }} - {{.}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} - {{.}}{{end}}{{ if not .Date.IsZero }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} - {{- with .OutputFormats.Get "RSS" -}} - {{ printf "" .RelPermalink .MediaType | safeHTML }} - {{- end -}} - {{ range $pages }} - {{ if eq .Type "blog" }} - - {{ .Title }} - {{ .RelPermalink }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} - {{ .RelPermalink }} - - {{ $content := .Content }} - - {{ $content = replaceRE `a href="(#.*?)"` (printf "%s%s%s" "a href=\"" .RelPermalink "$1\"") $content }} - {{ $content = replaceRE `a href="^../(.*?)"` (printf "%s%s%s" "a href=\"" .RelPermalink "../$1\"") $content }} - {{ $content = replaceRE `a href="/(.*?)"` (printf "%s%s%s" "a href=\"" $baseurl "$1\"") $content }} - - - {{ $content = replaceRE `(?s:]*?class="link".*?<\/a>)` "" ($content | safeHTML) }} - - - {{ ` - -

- {{- else if (in .Params.cover.src "http") -}} -

- -

- {{- end -}} - {{ $content | safeHTML }} - ]]> -
- -
- {{ end }} - {{ end }} -
-
\ No newline at end of file