diff options
author | mms <michal@sapka.me> | 2024-05-19 15:33:26 +0200 |
---|---|---|
committer | mms <michal@sapka.me> | 2024-05-19 15:33:26 +0200 |
commit | f4bb92435d069f84ce41d4ecae51641872de2270 (patch) | |
tree | e830735f772bd789473884dafbeabc8cad63dc8f /themes/sapka-2024/layouts | |
parent | e25abc08a5d3e7b94b638d837d26acbc0b79f14b (diff) |
feat: themes
Diffstat (limited to 'themes/sapka-2024/layouts')
-rw-r--r-- | themes/sapka-2024/layouts/_default/baseof.html | 30 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/index.html | 27 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/list.html | 26 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/page.html | 0 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/section.html | 0 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/single.html | 13 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/taxonomy.html | 0 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/_default/term.html | 0 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/list.txt | 7 | ||||
-rw-r--r-- | themes/sapka-2024/layouts/rss.xml | 73 |
10 files changed, 176 insertions, 0 deletions
diff --git a/themes/sapka-2024/layouts/_default/baseof.html b/themes/sapka-2024/layouts/_default/baseof.html new file mode 100644 index 0000000..e348fd5 --- /dev/null +++ b/themes/sapka-2024/layouts/_default/baseof.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html lang="en"> + {{ partial "header/meta" . }} + + {{ $section_class := "mms"}} + {{ if in .Page.Params.categories "star-trek" }} + {{ $section_class = "star-trek" }} + {{ else if in .Page.Params.category "site-info" }} + {{ $section_class = "site-info" }} + {{ else if in .Page.Params.categories "bsd" }} + {{ $section_class = "bsd" }} + {{ else if in .Page.Params.categories "blog" }} + {{ $section_class = "blog" }} + {{ else if in .Page.Params.categories "article" }} + {{ $section_class = "article" }} + {{ else if in .Page.Params.categories "emacs" }} + {{ $section_class = "emacs" }} + {{ else if in .Page.Params.categories "brainrot" }} + {{ $section_class = "brain-rot" }} + {{ end }} + <body class="{{ $section_class }}"> + {{ partial "header/header" . }} + + <main class="right-column"> + {{ block "main" . }} + {{ end }} + </main> + {{ partial "footer/footer" . }} + </body> +</html> diff --git a/themes/sapka-2024/layouts/_default/index.html b/themes/sapka-2024/layouts/_default/index.html new file mode 100644 index 0000000..dfda0d2 --- /dev/null +++ b/themes/sapka-2024/layouts/_default/index.html @@ -0,0 +1,27 @@ +{{ define "main" }} + +{{ partial "partials/homepage/nav" . }} + +<h2>Recent updates and publications </h2> + +{{ range first 10 +.Site.RegularPages.ByDate.Reverse +}} +{{ partial "partials/article_list_item.html" . }} +{{ end }} +<p> + <a href="/blog/">» Go to blog</a> +</p> + +{{ partial "partials/homepage/brainrot" . }} +{{ partial "partials/homepage/bsd.html" . }} +{{ partial "partials/homepage/emacs.html" . }} +{{ partial "partials/homepage/startrek.html" . }} +{{ partial "partials/homepage/omake.html" . }} +{{ partial "partials/homepage/buttons.html" . }} +{{ partial "partials/homepage/nameplate.html" . }} + +{{ end }} + + + diff --git a/themes/sapka-2024/layouts/_default/list.html b/themes/sapka-2024/layouts/_default/list.html new file mode 100644 index 0000000..2b045b8 --- /dev/null +++ b/themes/sapka-2024/layouts/_default/list.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 }} diff --git a/themes/sapka-2024/layouts/_default/page.html b/themes/sapka-2024/layouts/_default/page.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/sapka-2024/layouts/_default/page.html diff --git a/themes/sapka-2024/layouts/_default/section.html b/themes/sapka-2024/layouts/_default/section.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/sapka-2024/layouts/_default/section.html diff --git a/themes/sapka-2024/layouts/_default/single.html b/themes/sapka-2024/layouts/_default/single.html new file mode 100644 index 0000000..bed5a61 --- /dev/null +++ b/themes/sapka-2024/layouts/_default/single.html @@ -0,0 +1,13 @@ +{{ define "main" }} + +<article> + {{ .Page.Content }} +</article> + +{{- if .Params.primary_menu }} + {{ partial "single/bottom_nav.html" (dict "menuID" .Page.Params.primary_menu "page" .) }} +{{- end }} + +{{ partial "single/dates.html" . }} + +{{- end }} diff --git a/themes/sapka-2024/layouts/_default/taxonomy.html b/themes/sapka-2024/layouts/_default/taxonomy.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/sapka-2024/layouts/_default/taxonomy.html diff --git a/themes/sapka-2024/layouts/_default/term.html b/themes/sapka-2024/layouts/_default/term.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/sapka-2024/layouts/_default/term.html diff --git a/themes/sapka-2024/layouts/list.txt b/themes/sapka-2024/layouts/list.txt new file mode 100644 index 0000000..430a2d2 --- /dev/null +++ b/themes/sapka-2024/layouts/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/rss.xml b/themes/sapka-2024/layouts/rss.xml new file mode 100644 index 0000000..99b99cd --- /dev/null +++ b/themes/sapka-2024/layouts/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> |