diff options
author | mms <michal@sapka.me> | 2024-05-21 19:55:20 +0200 |
---|---|---|
committer | mms <michal@sapka.me> | 2024-05-21 19:55:20 +0200 |
commit | 44d3a27d6619b8bb734af5004df515e7781aba21 (patch) | |
tree | 2587bc175d9e87eb68babb5d84115ac1c0a25983 /themes/sapka-2024/layouts/_default | |
parent | f7ad8e833da3116fdee2a1c5664f78bc8b1de312 (diff) |
fix: urls and layout:
Diffstat (limited to 'themes/sapka-2024/layouts/_default')
-rw-r--r-- | themes/sapka-2024/layouts/_default/list.txt | 7 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/page.html | 1 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/rss.xml | 73 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/section.html | 26 |
4 files changed, 107 insertions, 0 deletions
diff --git a/themes/sapka-2024/layouts/_default/list.txt b/themes/sapka-2024/layouts/_default/list.txt new file mode 100644 index 0000000..430a2d2 --- /dev/null +++ b/themes/sapka-2024/layouts/_default/list.txt @@ -0,0 +1,7 @@ +{{- range .Pages.GroupBy "Section" }} + {{- with $.Site.GetPage "section" .Key }} + {{- range .Pages }} + {{ .Permalink }} + {{- end }} + {{- end }} +{{- end }} diff --git a/themes/sapka-2024/layouts/_default/page.html b/themes/sapka-2024/layouts/_default/page.html index e69de29..93f59a3 100644 --- a/themes/sapka-2024/layouts/_default/page.html +++ b/themes/sapka-2024/layouts/_default/page.html @@ -0,0 +1 @@ +aa aa diff --git a/themes/sapka-2024/layouts/_default/rss.xml b/themes/sapka-2024/layouts/_default/rss.xml new file mode 100644 index 0000000..99b99cd --- /dev/null +++ b/themes/sapka-2024/layouts/_default/rss.xml @@ -0,0 +1,73 @@ +{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} +{{- $authorEmail := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .email }} + {{- $authorEmail = . }} + {{- end }} + {{- end }} +{{- else }} + {{- with site.Author.email }} + {{- $authorEmail = . }} + {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} + {{- end }} +{{- end }} + +{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}} +{{- $authorName := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .name }} + {{- $authorName = . }} + {{- end }} + {{- else }} + {{- $authorName = . }} + {{- end }} +{{- else }} + {{- with site.Author.name }} + {{- $authorName = . }} + {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} + {{- end }} +{{- end }} + +{{- $pctx := . }} +{{- if .IsHome }}{{ $pctx = .Site }}{{ end }} +{{- $pages := slice }} +{{- if $.IsHome }} +{{- $pages = $pctx.RegularPages}} +{{- else if $.IsSection }} +{{- $pages = $pctx.RegularPagesRecursive}} +{{- else }} +{{- $pages = $pctx.Pages }} +{{- end }} +{{- $limit := .Site.Config.Services.RSS.Limit }} +{{- if ge $limit 1 }} +{{- $pages = $pages | first $limit }} +{{- end }} +{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description> + <generator>Hugo -- gohugo.io</generator> + <language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }} + <managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }} + <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }} + <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }} + <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} + {{- with .OutputFormats.Get "RSS" }} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} + {{- end }} + {{- range $pages.ByPublishDate.Reverse}} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }} + <guid>{{ crypto.MD5 .Date }}</guid> + <description>{{ safeHTML "<![CDATA[" }}{{ replace .Content "\n\n" "\n" | safeHTML }}<hr><p style="font-style:italic">Reply via <a href="https://michal.sapka.me/me/contact/">email</a></p>]]></description> + </item> + {{- end }} + </channel> +</rss> diff --git a/themes/sapka-2024/layouts/_default/section.html b/themes/sapka-2024/layouts/_default/section.html index e69de29..2b045b8 100644 --- a/themes/sapka-2024/layouts/_default/section.html +++ b/themes/sapka-2024/layouts/_default/section.html @@ -0,0 +1,26 @@ +{{ define "main" }} + +{{if .Page.Content}} + {{ .Page.Content }} + {{- if .Params.primary_menu }} + {{ partial "single/bottom_nav.html" (dict "menuID" .Page.Params.primary_menu "page" .) }} + {{- end }} + + {{ partial "single/dates.html" . }} +{{ else }} + + {{ if in .Page.Params.Categories "blog" }} + {{ partial "partials/blog_index.html" . }} + {{ else if in .Page.Params.Categories "article" }} + {{ partial "partials/article_index.html" . }} + {{ else }} + + <h2>Articles</h2> + {{ range .Data.Pages }} + {{ partial "partials/article_list_item.html" . }} + {{ end }} + + {{ end }} +{{end}} + +{{ end }} |