diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..4dd1fe46 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gohugo-theme-ananke"] + path = gohugo-theme-ananke + url = https://github.com/budparr/gohugo-theme-ananke.git diff --git a/config.toml b/config.toml index 09aa0561..6bc9f059 100644 --- a/config.toml +++ b/config.toml @@ -1,19 +1,30 @@ baseURL = "https://jk.nipponalba.scot" languageCode = "en-gb" title = "JK's homepage" -theme=["nipponalba", "hugo-atom-feed"] +theme=["nipponalba"] summarylength=30 enableEmoji=true defaultContentLanguage="en" ignoreErrors = ["error-remote-getjson"] - [outputs] - home = ["html", "rss"] # default = ["HTML", "RSS"] + home = ["html", "rss", "atom"] # default = ["HTML", "RSS"] section = ["html", "rss"] # default = ["HTML", "RSS"] term = ["html", "rss"] # default = ["HTML", "RSS"] taxonomy = ["html", "rss"] # default = ["HTML", "RSS"] +# Define a new ATOM output format +[outputFormats] +[outputFormats.ATOM] +name = "ATOM" +baseName = "feed" +mediaType = "application/atom+xml" + +# Define a new ATOM media type +[mediaTypes] +[mediaTypes."application/atom+xml"] +suffixes = ["atom"] + [markup] [markup.goldmark] [markup.goldmark.extensions] @@ -55,6 +66,7 @@ images = ["images/profile.jpg"] siteLogo = "images/na-sm.png" keywords = "" favicon = "favicons/" +mainSections = ["article"] [languages.en.Params] description = "Quintessentially Celtic, vehemently Viking, passionately European, unashamedly, proudly Scottish, craft beer and single malt whisky lover, enthusiastic cook, vegan, perpetually exhausted dad, pronouns: he/him" diff --git a/data/authors.toml b/data/authors.toml new file mode 100644 index 00000000..50d7db31 --- /dev/null +++ b/data/authors.toml @@ -0,0 +1,11 @@ +[default] +name = "J K 🇯🇵🏴" +uri = "https://jk.nipponalba.scot/" +email = "jk@nipponalba.scot" +image = "images/profile.jpg" + +[jk] +name = "J K 🇯🇵🏴" +uri = "https://jk.nipponalba.scot/" +email = "jk@nipponalba.scot" +image = "images/profile.jpg" diff --git a/gohugo-theme-ananke b/gohugo-theme-ananke new file mode 160000 index 00000000..8845854a --- /dev/null +++ b/gohugo-theme-ananke @@ -0,0 +1 @@ +Subproject commit 8845854aa9ab5af79066e840d8c884fbbb8a269d diff --git a/themes/hugo-atom-feed/layouts/_default/list.atom.xml b/themes/hugo-atom-feed/layouts/_default/list.atom.xml index f31a635d..25082af0 100644 --- a/themes/hugo-atom-feed/layouts/_default/list.atom.xml +++ b/themes/hugo-atom-feed/layouts/_default/list.atom.xml @@ -1,108 +1,55 @@ -{{ printf `` | safeHTML }} {{/* ref: https://validator.w3.org/feed/docs/atom.html */}} - - Hugo - - {{- $title := site.Title -}} - {{- with .Title -}} - {{- if (not (eq . site.Title)) -}} - {{- $title = printf `%s %s %s` . (i18n "feed_title_on" | default "on") site.Title -}} - {{- end -}} + {{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}} + {{- $limit := .Site.Config.Services.RSS.Limit -}} + {{- if ge $limit 1 -}} + {{- $pages = $pages | first $limit -}} {{- end -}} - {{ printf `<![CDATA[%s]]>` $title | safeHTML }} - {{ with (or (.Param "subtitle") (.Param "tagline")) }} - {{ printf `` . | safeHTML }} - {{ end }} - {{ $output_formats := .OutputFormats }} - {{ range $output_formats -}} - {{- $rel := (or (and (eq "atom" (.Name | lower)) "self") "alternate") -}} - {{ with $output_formats.Get .Name }} - {{ printf `` .Permalink $rel .MediaType.Type .Name | safeHTML }} - {{- end -}} - {{- end }} - {{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }} - {{ with site.Copyright }} - {{- $copyright := replace . "{year}" now.Year -}} {{/* In case the site.copyright uses a special string "{year}" */}} - {{- $copyright = replace $copyright "©" "©" -}} - {{ $copyright | plainify }} - {{- end }} - {{ with .Param "feed" }} - {{/* For this to work, the $icon file should be present in the assets/ directory */}} - {{- $icon := .icon | default "icon.svg" -}} - {{- with resources.Get $icon -}} - {{ (. | fingerprint).Permalink }} - {{- end }} - - {{/* For this to work, the $logo file should be present in the assets/ directory */}} - {{- $logo := .logo | default "logo.svg" -}} - {{- with resources.Get $logo -}} - {{ (. | fingerprint).Permalink }} - {{- end }} - {{ end }} - {{ with site.Author.name -}} + {{ printf "" | safeHTML }} + + Hugo + + {{ .Site.Title }} + {{- with .Site.Params.brand.tagline }} + {{ . }} + {{- end }} + {{ "/" | absLangURL }} + + {{ .Site.Title }} + {{ "/" | absLangURL }} + + Hugo gohugo.io + {{- with .Site.Copyright }} + {{ . }} + {{- end }} + {{- with .Site.Params.brand.icon }} + {{ . | absURL }} + {{- end }} + {{- with .Site.Params.brand.logo }} + {{ . | absURL }} + {{- end }} + {{ dateFormat "2006-01-02T15:04:05Z" now.UTC | safeHTML }} + {{- with .OutputFormats.Get "ATOM" }} + {{ printf `` .MediaType.Type .Permalink $.Site.LanguageCode | safeHTML }} + {{- end }} + {{- range .AlternativeOutputFormats }} + {{ printf `` .MediaType.Type .Permalink $.Site.LanguageCode | safeHTML }} + {{- end }} + {{- range $pages }} + + {{ .Title }} + {{- $author := index .Site.Data.authors (.Params.author | default "default") }} - {{ . }} - {{ with site.Author.email }} - {{ . }} - {{ end -}} + {{ $author.name }} + {{ $author.uri }} - {{- end }} - {{ with site.Params.id }} - {{ . | plainify }} - {{ else }} {{ .Permalink }} - {{ end }} - {{- $limit := (cond (le site.Config.Services.RSS.Limit 0) 65536 site.Config.Services.RSS.Limit) }} - {{- $feed_sections := site.Params.feedSections | default site.Params.mainSections -}} - {{/* Range through only the pages with a Type in $feed_sections. */}} - {{- $pages := where .RegularPages "Type" "in" $feed_sections -}} - {{- if (eq .Kind "home") -}} - {{- $pages = where site.RegularPages "Type" "in" $feed_sections -}} - {{- end -}} - {{/* Remove the pages that have the disable_feed parameter set to true. */}} - {{- $pages = where $pages ".Params.disable_feed" "!=" true -}} - {{- range first $limit $pages }} - {{ $page := . }} - - {{ printf `<![CDATA[%s]]>` .Title | safeHTML }} - - {{- range .Translations }} - {{- $link := printf "%s?utm_source=atom_feed" .Permalink | safeHTML }} - {{- printf `` $link .Lang | safeHTML }} - {{- end }} - {{/* rel=related: See https://validator.w3.org/feed/docs/atom.html#link */}} - {{- range first 5 (site.RegularPages.Related .) }} - - {{- end }} - {{ with .Params.id }} - {{ . | plainify }} - {{ else }} - {{ .Permalink }} - {{ end }} - {{ with .Params.author -}} - {{- range . -}} - - {{ . }} - - {{- end -}} - {{- end }} - {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }} - {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }} - {{ $description1 := .Description | default "" }} - {{ $description := (cond (eq "" $description1) "" (printf "
%s
" ($description1 | markdownify))) }} - {{ printf `` $description .Content | safeHTML }} - {{ with site.Taxonomies }} - {{ range $taxo,$_ := . }} - {{ with $page.Param $taxo }} - {{ $taxo_list := . }} - {{ with site.GetPage (printf "/%s" $taxo) }} - {{ $taxonomy_page := . }} - {{ range $taxo_list }} - - {{ end }} - {{ end }} - {{ end }} - {{ end }} - {{ end }} -
- {{ end }} -
+ {{- if .IsTranslated -}} + {{ range .Translations }} + + {{- end -}} + {{ end }} + {{ dateFormat "2006-01-02T15:04:05Z" .Lastmod.UTC | safeHTML }} + {{ dateFormat "2006-01-02T15:04:05Z" .Date.UTC | safeHTML }} + {{ trim .Content "\n" }} + + {{- end }} +
diff --git a/themes/nipponalba/layouts/index.atom b/themes/nipponalba/layouts/index.atom new file mode 100644 index 00000000..f31a635d --- /dev/null +++ b/themes/nipponalba/layouts/index.atom @@ -0,0 +1,108 @@ +{{ printf `` | safeHTML }} {{/* ref: https://validator.w3.org/feed/docs/atom.html */}} + + Hugo + + {{- $title := site.Title -}} + {{- with .Title -}} + {{- if (not (eq . site.Title)) -}} + {{- $title = printf `%s %s %s` . (i18n "feed_title_on" | default "on") site.Title -}} + {{- end -}} + {{- end -}} + {{ printf `<![CDATA[%s]]>` $title | safeHTML }} + {{ with (or (.Param "subtitle") (.Param "tagline")) }} + {{ printf `` . | safeHTML }} + {{ end }} + {{ $output_formats := .OutputFormats }} + {{ range $output_formats -}} + {{- $rel := (or (and (eq "atom" (.Name | lower)) "self") "alternate") -}} + {{ with $output_formats.Get .Name }} + {{ printf `` .Permalink $rel .MediaType.Type .Name | safeHTML }} + {{- end -}} + {{- end }} + {{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + {{ with site.Copyright }} + {{- $copyright := replace . "{year}" now.Year -}} {{/* In case the site.copyright uses a special string "{year}" */}} + {{- $copyright = replace $copyright "©" "©" -}} + {{ $copyright | plainify }} + {{- end }} + {{ with .Param "feed" }} + {{/* For this to work, the $icon file should be present in the assets/ directory */}} + {{- $icon := .icon | default "icon.svg" -}} + {{- with resources.Get $icon -}} + {{ (. | fingerprint).Permalink }} + {{- end }} + + {{/* For this to work, the $logo file should be present in the assets/ directory */}} + {{- $logo := .logo | default "logo.svg" -}} + {{- with resources.Get $logo -}} + {{ (. | fingerprint).Permalink }} + {{- end }} + {{ end }} + {{ with site.Author.name -}} + + {{ . }} + {{ with site.Author.email }} + {{ . }} + {{ end -}} + + {{- end }} + {{ with site.Params.id }} + {{ . | plainify }} + {{ else }} + {{ .Permalink }} + {{ end }} + {{- $limit := (cond (le site.Config.Services.RSS.Limit 0) 65536 site.Config.Services.RSS.Limit) }} + {{- $feed_sections := site.Params.feedSections | default site.Params.mainSections -}} + {{/* Range through only the pages with a Type in $feed_sections. */}} + {{- $pages := where .RegularPages "Type" "in" $feed_sections -}} + {{- if (eq .Kind "home") -}} + {{- $pages = where site.RegularPages "Type" "in" $feed_sections -}} + {{- end -}} + {{/* Remove the pages that have the disable_feed parameter set to true. */}} + {{- $pages = where $pages ".Params.disable_feed" "!=" true -}} + {{- range first $limit $pages }} + {{ $page := . }} + + {{ printf `<![CDATA[%s]]>` .Title | safeHTML }} + + {{- range .Translations }} + {{- $link := printf "%s?utm_source=atom_feed" .Permalink | safeHTML }} + {{- printf `` $link .Lang | safeHTML }} + {{- end }} + {{/* rel=related: See https://validator.w3.org/feed/docs/atom.html#link */}} + {{- range first 5 (site.RegularPages.Related .) }} + + {{- end }} + {{ with .Params.id }} + {{ . | plainify }} + {{ else }} + {{ .Permalink }} + {{ end }} + {{ with .Params.author -}} + {{- range . -}} + + {{ . }} + + {{- end -}} + {{- end }} + {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + {{ $description1 := .Description | default "" }} + {{ $description := (cond (eq "" $description1) "" (printf "
%s
" ($description1 | markdownify))) }} + {{ printf `` $description .Content | safeHTML }} + {{ with site.Taxonomies }} + {{ range $taxo,$_ := . }} + {{ with $page.Param $taxo }} + {{ $taxo_list := . }} + {{ with site.GetPage (printf "/%s" $taxo) }} + {{ $taxonomy_page := . }} + {{ range $taxo_list }} + + {{ end }} + {{ end }} + {{ end }} + {{ end }} + {{ end }} +
+ {{ end }} +
diff --git a/themes/nipponalba/layouts/partials/head.html b/themes/nipponalba/layouts/partials/head.html index 6e9139c7..25a4ee2f 100644 --- a/themes/nipponalba/layouts/partials/head.html +++ b/themes/nipponalba/layouts/partials/head.html @@ -30,7 +30,7 @@ - + {{ if eq .Type "article" }}