diff options
| -rw-r--r-- | layouts/404.html | 4 | ||||
| -rw-r--r-- | layouts/_partials/head.html | 20 | ||||
| -rw-r--r-- | layouts/_partials/header.html | 4 | ||||
| -rw-r--r-- | layouts/_partials/pageinfo.html | 44 | ||||
| -rw-r--r-- | layouts/home.atom.xml | 58 | ||||
| -rw-r--r-- | layouts/home.gemini_atom.xml | 58 | ||||
| -rw-r--r-- | layouts/home.html | 20 | ||||
| -rw-r--r-- | layouts/section.html | 16 | ||||
| -rw-r--r-- | layouts/single.html | 14 | ||||
| -rw-r--r-- | layouts/taxonomy.atom.xml | 58 | ||||
| -rw-r--r-- | layouts/taxonomy.gemini_atom.xml | 58 | ||||
| -rw-r--r-- | layouts/taxonomy.html | 8 | ||||
| -rw-r--r-- | layouts/term.atom.xml | 58 | ||||
| -rw-r--r-- | layouts/term.gemini_atom.xml | 58 | ||||
| -rw-r--r-- | layouts/term.html | 8 |
15 files changed, 249 insertions, 237 deletions
diff --git a/layouts/404.html b/layouts/404.html index fffedc1..c3b2903 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,8 +1,8 @@ -{{ define "main" -}} +{{ define "main" }} <nav> <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> <main class="main"> <h1 id="404">{{ i18n "pageNotFound" }}</h1> </main> -{{- end }} +{{ end }} diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html index 0c5a796..8487d06 100644 --- a/layouts/_partials/head.html +++ b/layouts/_partials/head.html @@ -2,24 +2,24 @@ <meta charset="utf-8"> <meta name="theme-color" content="#000"> <meta name="viewport" content="width=device-width, initial-scale=1"> - {{- if $.Site.Params.description }} + {{ if $.Site.Params.description }} <meta name="description" content="{{ $.Site.Params.description }}"> - {{- end -}} + {{ end }} {{ if $.Site.Params.keywords }} <meta name="keywords" content="{{ $.Site.Params.keywords }}"> - {{- end -}} + {{ end }} {{ range .Site.Params.custom_css | default (slice "static/css/style.css") }} - {{- with resources.Get . }} + {{ with resources.Get . }} <link rel="stylesheet" type="text/css" href="{{ (. | minify | fingerprint).RelPermalink }}"> - {{- else }} - {{- errorf "stylesheet %q listed in params.custom_css was not found in the assets directory" . }} - {{- end }} - {{- end -}} + {{ else }} + {{ errorf "stylesheet %q listed in params.custom_css was not found in the assets directory" . }} + {{ end }} + {{ end }} {{ with .OutputFormats.Get "Atom" }} <link rel="alternate" type="application/atom+xml" href="{{ .RelPermalink }}" title="{{ $.Site.Title }}"> - {{- end -}} + {{ end }} {{ if (not (fileExists "static/favicon.ico")) }} <link rel="icon" href="data:,"> - {{- end }} + {{ end }} <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} - {{ .Site.Title }}{{ end }}</title> </head>
\ No newline at end of file diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html index 0c2d87e..4e330aa 100644 --- a/layouts/_partials/header.html +++ b/layouts/_partials/header.html @@ -1,7 +1,7 @@ -{{ if fileExists "templates/logo.txt" -}} +{{ if fileExists "templates/logo.txt" }} <header class="logo"> <pre class="logo__text"> {{ chomp (readFile "templates/logo.txt") }} </pre> </header> -{{- end -}} +{{ end }} diff --git a/layouts/_partials/pageinfo.html b/layouts/_partials/pageinfo.html index 47f1194..b9a8d63 100644 --- a/layouts/_partials/pageinfo.html +++ b/layouts/_partials/pageinfo.html @@ -1,28 +1,28 @@ -{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}} +{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" }} -{{/* user-overridable parameter $dateFormat is escaped pre-insertion so that HTML entities can be inserted */ -}} -{{ $nonBreakingPublishDate := .Page.PublishDate | time.Format $dateFormat | htmlEscape -}} -{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate " " " " -}} -{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate "-" "‑" -}} +{{/* user-overridable parameter $dateFormat is escaped pre-insertion so that HTML entities can be inserted */}} +{{ $nonBreakingPublishDate := .Page.PublishDate | time.Format $dateFormat | htmlEscape }} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate " " " " }} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate "-" "‑" }} -{{/* user-overridable parameter $readingTime is escaped pre-insertion so that HTML entities can be inserted */ -}} -{{ $nonBreakingReadingTime := i18n "readingTime" .ReadingTime | htmlEscape -}} -{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime " " " " -}} -{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime "-" "‑" -}} +{{/* user-overridable parameter $readingTime is escaped pre-insertion so that HTML entities can be inserted */}} +{{ $nonBreakingReadingTime := i18n "readingTime" .ReadingTime | htmlEscape }} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime " " " " }} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime "-" "‑" }} -{{ $breakingTags := .Param (lower (i18n "tags")) -}} -{{ $nonBreakingTags := slice -}} -{{ range $breakingTags -}} - {{/* user-defined tags are escaped pre-insertion so that HTML entities can be inserted */ -}} - {{ $nonBreakingTag := htmlEscape . -}} - {{ $nonBreakingTag = replace $nonBreakingTag " " " " -}} - {{ $nonBreakingTag = replace $nonBreakingTag "-" "‑" -}} - {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag -}} -{{ end -}} +{{ $breakingTags := .Param (lower (i18n "tags")) }} +{{ $nonBreakingTags := slice }} +{{ range $breakingTags }} + {{/* user-defined tags are escaped pre-insertion so that HTML entities can be inserted */}} + {{ $nonBreakingTag := htmlEscape . }} + {{ $nonBreakingTag = replace $nonBreakingTag " " " " }} + {{ $nonBreakingTag = replace $nonBreakingTag "-" "‑" }} + {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag }} +{{ end }} -{{/* user-overridable parameter $audioAvailable is escaped pre-insertion so that HTML entities can be inserted */ -}} -{{ $nonBreakingAudioAvailable := i18n "audioAvailable" .Title | htmlEscape -}} -{{ $nonBreakingAudioAvailable = replace $nonBreakingAudioAvailable " " " " -}} -{{ $nonBreakingAudioAvailable = replace $nonBreakingAudioAvailable "-" "‑" -}} +{{/* user-overridable parameter $audioAvailable is escaped pre-insertion so that HTML entities can be inserted */}} +{{ $nonBreakingAudioAvailable := i18n "audioAvailable" .Title | htmlEscape }} +{{ $nonBreakingAudioAvailable = replace $nonBreakingAudioAvailable " " " " }} +{{ $nonBreakingAudioAvailable = replace $nonBreakingAudioAvailable "-" "‑" }} <span class="meta-item">{{ emojify ":calendar:" }} <time {{ printf "datetime=%q" (.Page.PublishDate | time.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>{{ $nonBreakingPublishDate | safeHTML }}</time></span><span class="meta-item">{{ emojify ":stopwatch:" }} <time datetime="PT{{ .ReadingTime }}M">{{ $nonBreakingReadingTime | safeHTML }}</time></span>{{ if where .Resources "MediaType.MainType" "audio" }}<span class="meta-item">{{ emojify ":headphones:" }} {{ $nonBreakingAudioAvailable | safeHTML }}</span>{{ end }}{{ if $nonBreakingTags }}<span class="meta-item">{{ emojify ":label:" }} {{ range $key, $val := $nonBreakingTags }}{{ if $key }} {{ end }}<a class="link link--internal" href='{{ relLangURL (lower (i18n "tags")) }}/{{ index $breakingTags $key | urlize }}/' rel="noreferrer">{{ $val | safeHTML }}</a>{{ end }}</span>{{ end }} diff --git a/layouts/home.atom.xml b/layouts/home.atom.xml index 14b441e..1a67205 100644 --- a/layouts/home.atom.xml +++ b/layouts/home.atom.xml @@ -1,32 +1,34 @@ -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- end }} -{{- if not $authorName }} - {{- errorf "Missing author" }} -{{- end }} +{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{/* The XML declaration is emitted before anything else, including the + variables below, since whitespace may not precede it. */}} +{{ $authorName := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .name }} + {{ $authorName = . }} + {{ end }} + {{ else }} + {{ $authorName = . }} + {{ end }} +{{ end }} +{{ if not $authorName }} + {{ errorf "Missing author" }} +{{ end }} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- end -}} +{{ $authorEmail := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .email }} + {{ $authorEmail = . }} + {{ end }} + {{ end }} +{{ end }} -{{- $pages := (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse }} -{{- $limit := .Site.Config.Services.RSS.Limit }} -{{- if ge $limit 1 }} -{{- $pages = first $limit $pages }} -{{- end -}} -{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{ $pages := (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse }} +{{ $limit := .Site.Config.Services.RSS.Limit }} +{{ if ge $limit 1 }} +{{ $pages = first $limit $pages }} +{{ end }} <feed xmlns="http://www.w3.org/2005/Atom"> <id>{{ .Permalink }}</id> <title>{{ .Site.Title }}</title> @@ -35,7 +37,7 @@ <link href="{{ .Permalink }}" rel="alternate" /> <author> <name>{{ $authorName }}</name> - {{- with $authorEmail }} + {{ with $authorEmail }} <email>{{ . }}</email>{{ end }} </author> <generator>Hugo -- gohugo.io</generator> diff --git a/layouts/home.gemini_atom.xml b/layouts/home.gemini_atom.xml index fac5283..e738378 100644 --- a/layouts/home.gemini_atom.xml +++ b/layouts/home.gemini_atom.xml @@ -1,32 +1,34 @@ -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- end }} -{{- if not $authorName }} - {{- errorf "Missing author" }} -{{- end }} +{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{/* The XML declaration is emitted before anything else, including the + variables below, since whitespace may not precede it. */}} +{{ $authorName := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .name }} + {{ $authorName = . }} + {{ end }} + {{ else }} + {{ $authorName = . }} + {{ end }} +{{ end }} +{{ if not $authorName }} + {{ errorf "Missing author" }} +{{ end }} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- end -}} +{{ $authorEmail := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .email }} + {{ $authorEmail = . }} + {{ end }} + {{ end }} +{{ end }} -{{- $pages := (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse }} -{{- $limit := .Site.Config.Services.RSS.Limit }} -{{- if ge $limit 1 }} -{{- $pages = first $limit $pages }} -{{- end -}} -{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{ $pages := (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse }} +{{ $limit := .Site.Config.Services.RSS.Limit }} +{{ if ge $limit 1 }} +{{ $pages = first $limit $pages }} +{{ end }} <feed xmlns="http://www.w3.org/2005/Atom"> <id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id> <title>{{ .Site.Title }}</title> @@ -35,7 +37,7 @@ <link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" /> <author> <name>{{ $authorName }}</name> - {{- with $authorEmail }} + {{ with $authorEmail }} <email>{{ . }}</email>{{ end }} </author> <generator>Hugo -- gohugo.io</generator> diff --git a/layouts/home.html b/layouts/home.html index 3056518..bdaa6af 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -1,22 +1,22 @@ -{{ define "main" -}} +{{ define "main" }} <main class="main"> <h1>{{ .Site.Params.indexTitle }}</h1> <p>{{ .Site.Params.indexIntro }}</p> - {{ if .Site.Menus.main -}} + {{ if .Site.Menus.main }} <h2>{{ i18n "navLinks" }}</h2> <nav> <ul class="list"> - {{- range .Site.Menus.main }} + {{ range .Site.Menus.main }} <li class="list__item">{{ emojify ":link:" }} <a class="link link--internal" href="{{ .URL }}" rel="noreferrer">{{ .Name }}</a></li> - {{- end }} + {{ end }} </ul> </nav> - {{ end -}} - {{ with (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse -}} + {{ end }} + {{ with (where .Site.RegularPages "Section" "entry").ByPublishDate.Reverse }} <h2>{{ i18n "journalEntries" }}</h2> - {{ range . -}} + {{ range . }} {{ partial "metadata.html" . }} - {{ end -}} - {{ end -}} + {{ end }} + {{ end }} </main> -{{- end }}
\ No newline at end of file +{{ end }}
\ No newline at end of file diff --git a/layouts/section.html b/layouts/section.html index b4d49c0..3123e18 100644 --- a/layouts/section.html +++ b/layouts/section.html @@ -1,18 +1,18 @@ -{{ define "main" -}} +{{ define "main" }} <nav> <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> <main class="main"> <h1>{{ .Title }}</h1> - {{ with .OutputFormats.Get "Atom" -}} + {{ with .OutputFormats.Get "Atom" }} <h2>{{ i18n "feeds" }}</h2> <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .RelPermalink }}" rel="noreferrer">{{ i18n "atomFeed" }}</a></p> - {{ end -}} - {{ with .Pages.ByPublishDate.Reverse -}} + {{ end }} + {{ with .Pages.ByPublishDate.Reverse }} <h2>{{ i18n "journalEntries" }}</h2> - {{ range . -}} + {{ range . }} {{ partial "metadata.html" . }} - {{ end -}} - {{ end -}} + {{ end }} + {{ end }} </main> -{{- end }} +{{ end }} diff --git a/layouts/single.html b/layouts/single.html index bb9b10e..ead0c52 100644 --- a/layouts/single.html +++ b/layouts/single.html @@ -1,23 +1,23 @@ -{{ define "main" -}} +{{ define "main" }} <nav> <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> <main class="main"> {{/* derived from the page's own URL so that it is stable and unique for - single files, page bundles and pages built by a content adapter alike */ -}} - {{ $headingID := path.Base .RelPermalink | strings.TrimSuffix ".html" -}} + single files, page bundles and pages built by a content adapter alike */}} + {{ $headingID := path.Base .RelPermalink | strings.TrimSuffix ".html" }} <div class="entry__details"> <h1 id="{{ $headingID }}" class="entry__heading">{{ .Title }}</h1> - {{- if (.Page.Params.pageinfo | default true) }} + {{ if (.Page.Params.pageinfo | default true) }} <p class="entry__pageinfo">{{ partial "pageinfo.html" . }}</p> - {{- end -}} + {{ end }} {{ with partial "audio.html" . }} <audio class="entry__audio" controls preload="metadata" aria-label="{{ i18n "audioVersion" $.Title }}"> {{ range . }}<source src="{{ .RelPermalink }}" type="{{ .MediaType }}"> {{ end }}{{ i18n "audioUnsupported" }} </audio> - {{- end }} + {{ end }} </div> {{ chomp (.Content) }} </main> -{{- end }}
\ No newline at end of file +{{ end }}
\ No newline at end of file diff --git a/layouts/taxonomy.atom.xml b/layouts/taxonomy.atom.xml index 601888f..7aa5e1e 100644 --- a/layouts/taxonomy.atom.xml +++ b/layouts/taxonomy.atom.xml @@ -1,32 +1,34 @@ -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- end }} -{{- if not $authorName }} - {{- errorf "Missing author" }} -{{- end }} +{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{/* The XML declaration is emitted before anything else, including the + variables below, since whitespace may not precede it. */}} +{{ $authorName := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .name }} + {{ $authorName = . }} + {{ end }} + {{ else }} + {{ $authorName = . }} + {{ end }} +{{ end }} +{{ if not $authorName }} + {{ errorf "Missing author" }} +{{ end }} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- end -}} +{{ $authorEmail := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .email }} + {{ $authorEmail = . }} + {{ end }} + {{ end }} +{{ end }} -{{- $pages := .Data.Pages.ByPublishDate.Reverse }} -{{- $limit := .Site.Config.Services.RSS.Limit }} -{{- if ge $limit 1 }} -{{- $pages = first $limit $pages }} -{{- end -}} -{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{ $pages := .Data.Pages.ByPublishDate.Reverse }} +{{ $limit := .Site.Config.Services.RSS.Limit }} +{{ if ge $limit 1 }} +{{ $pages = first $limit $pages }} +{{ end }} <feed xmlns="http://www.w3.org/2005/Atom"> <id>{{ .Permalink }}</id> <title>{{ .Site.Title }}</title> @@ -35,7 +37,7 @@ <link href="{{ .Permalink }}" rel="alternate" /> <author> <name>{{ $authorName }}</name> - {{- with $authorEmail }} + {{ with $authorEmail }} <email>{{ . }}</email>{{ end }} </author> <generator>Hugo -- gohugo.io</generator> diff --git a/layouts/taxonomy.gemini_atom.xml b/layouts/taxonomy.gemini_atom.xml index dbe90ae..f55fe07 100644 --- a/layouts/taxonomy.gemini_atom.xml +++ b/layouts/taxonomy.gemini_atom.xml @@ -1,32 +1,34 @@ -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- end }} -{{- if not $authorName }} - {{- errorf "Missing author" }} -{{- end }} +{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{/* The XML declaration is emitted before anything else, including the + variables below, since whitespace may not precede it. */}} +{{ $authorName := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .name }} + {{ $authorName = . }} + {{ end }} + {{ else }} + {{ $authorName = . }} + {{ end }} +{{ end }} +{{ if not $authorName }} + {{ errorf "Missing author" }} +{{ end }} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- end -}} +{{ $authorEmail := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .email }} + {{ $authorEmail = . }} + {{ end }} + {{ end }} +{{ end }} -{{- $pages := .Data.Pages.ByPublishDate.Reverse }} -{{- $limit := .Site.Config.Services.RSS.Limit }} -{{- if ge $limit 1 }} -{{- $pages = first $limit $pages }} -{{- end -}} -{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{ $pages := .Data.Pages.ByPublishDate.Reverse }} +{{ $limit := .Site.Config.Services.RSS.Limit }} +{{ if ge $limit 1 }} +{{ $pages = first $limit $pages }} +{{ end }} <feed xmlns="http://www.w3.org/2005/Atom"> <id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id> <title>{{ .Site.Title }}</title> @@ -35,7 +37,7 @@ <link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" /> <author> <name>{{ $authorName }}</name> - {{- with $authorEmail }} + {{ with $authorEmail }} <email>{{ . }}</email>{{ end }} </author> <generator>Hugo -- gohugo.io</generator> diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html index 2002ed3..c56a7d5 100644 --- a/layouts/taxonomy.html +++ b/layouts/taxonomy.html @@ -1,4 +1,4 @@ -{{ define "main" -}} +{{ define "main" }} <nav> <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> @@ -8,9 +8,9 @@ <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer">{{ i18n "atomFeed" }}</a></p> <h2>{{ i18n "list" }}</h2> <ul class="list"> - {{- range .Data.Pages }} + {{ range .Data.Pages }} <li class="list__item">{{ emojify ":link:" }} <a class="link link--internal" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></li> - {{- end }} + {{ end }} </ul> </main> -{{- end }}
\ No newline at end of file +{{ end }}
\ No newline at end of file diff --git a/layouts/term.atom.xml b/layouts/term.atom.xml index 601888f..7aa5e1e 100644 --- a/layouts/term.atom.xml +++ b/layouts/term.atom.xml @@ -1,32 +1,34 @@ -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- end }} -{{- if not $authorName }} - {{- errorf "Missing author" }} -{{- end }} +{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{/* The XML declaration is emitted before anything else, including the + variables below, since whitespace may not precede it. */}} +{{ $authorName := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .name }} + {{ $authorName = . }} + {{ end }} + {{ else }} + {{ $authorName = . }} + {{ end }} +{{ end }} +{{ if not $authorName }} + {{ errorf "Missing author" }} +{{ end }} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- end -}} +{{ $authorEmail := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .email }} + {{ $authorEmail = . }} + {{ end }} + {{ end }} +{{ end }} -{{- $pages := .Data.Pages.ByPublishDate.Reverse }} -{{- $limit := .Site.Config.Services.RSS.Limit }} -{{- if ge $limit 1 }} -{{- $pages = first $limit $pages }} -{{- end -}} -{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{ $pages := .Data.Pages.ByPublishDate.Reverse }} +{{ $limit := .Site.Config.Services.RSS.Limit }} +{{ if ge $limit 1 }} +{{ $pages = first $limit $pages }} +{{ end }} <feed xmlns="http://www.w3.org/2005/Atom"> <id>{{ .Permalink }}</id> <title>{{ .Site.Title }}</title> @@ -35,7 +37,7 @@ <link href="{{ .Permalink }}" rel="alternate" /> <author> <name>{{ $authorName }}</name> - {{- with $authorEmail }} + {{ with $authorEmail }} <email>{{ . }}</email>{{ end }} </author> <generator>Hugo -- gohugo.io</generator> diff --git a/layouts/term.gemini_atom.xml b/layouts/term.gemini_atom.xml index dbe90ae..f55fe07 100644 --- a/layouts/term.gemini_atom.xml +++ b/layouts/term.gemini_atom.xml @@ -1,32 +1,34 @@ -{{- $authorName := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} - {{- else }} - {{- $authorName = . }} - {{- end }} -{{- end }} -{{- if not $authorName }} - {{- errorf "Missing author" }} -{{- end }} +{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{/* The XML declaration is emitted before anything else, including the + variables below, since whitespace may not precede it. */}} +{{ $authorName := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .name }} + {{ $authorName = . }} + {{ end }} + {{ else }} + {{ $authorName = . }} + {{ end }} +{{ end }} +{{ if not $authorName }} + {{ errorf "Missing author" }} +{{ end }} -{{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- end -}} +{{ $authorEmail := "" }} +{{ with site.Params.author }} + {{ if reflect.IsMap . }} + {{ with .email }} + {{ $authorEmail = . }} + {{ end }} + {{ end }} +{{ end }} -{{- $pages := .Data.Pages.ByPublishDate.Reverse }} -{{- $limit := .Site.Config.Services.RSS.Limit }} -{{- if ge $limit 1 }} -{{- $pages = first $limit $pages }} -{{- end -}} -{{ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | safeHTML }} +{{ $pages := .Data.Pages.ByPublishDate.Reverse }} +{{ $limit := .Site.Config.Services.RSS.Limit }} +{{ if ge $limit 1 }} +{{ $pages = first $limit $pages }} +{{ end }} <feed xmlns="http://www.w3.org/2005/Atom"> <id>{{ .Permalink | strings.TrimSuffix "index.gmi" }}</id> <title>{{ .Site.Title }}</title> @@ -35,7 +37,7 @@ <link href="{{ .Permalink | strings.TrimSuffix "index.gmi" | safeURL }}" rel="alternate" /> <author> <name>{{ $authorName }}</name> - {{- with $authorEmail }} + {{ with $authorEmail }} <email>{{ . }}</email>{{ end }} </author> <generator>Hugo -- gohugo.io</generator> diff --git a/layouts/term.html b/layouts/term.html index 3870c69..85622f4 100644 --- a/layouts/term.html +++ b/layouts/term.html @@ -1,4 +1,4 @@ -{{ define "main" -}} +{{ define "main" }} <nav> <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> @@ -7,8 +7,8 @@ <h2>{{ i18n "feeds" }}</h2> <p>{{ emojify ":link:" }} <a class="link link--internal" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer">{{ i18n "atomFeed" }}</a></p> <h2>{{ i18n "journalEntries" }}</h2> - {{- range .Data.Pages.ByPublishDate.Reverse }} - {{ partial "metadata.html" . -}} + {{ range .Data.Pages.ByPublishDate.Reverse }} + {{ partial "metadata.html" . }} {{ end }} </main> -{{- end }}
\ No newline at end of file +{{ end }}
\ No newline at end of file |
