diff options
Diffstat (limited to 'themes/PaperMod/layouts/_default')
-rw-r--r-- | themes/PaperMod/layouts/_default/_markup/render-image.html | 1 | ||||
-rw-r--r-- | themes/PaperMod/layouts/_default/archives.html | 49 | ||||
-rw-r--r-- | themes/PaperMod/layouts/_default/baseof.html | 23 | ||||
-rw-r--r-- | themes/PaperMod/layouts/_default/index.json | 7 | ||||
-rw-r--r-- | themes/PaperMod/layouts/_default/list.html | 89 | ||||
-rw-r--r-- | themes/PaperMod/layouts/_default/rss.xml | 50 | ||||
-rw-r--r-- | themes/PaperMod/layouts/_default/search.html | 29 | ||||
-rw-r--r-- | themes/PaperMod/layouts/_default/single.html | 59 | ||||
-rw-r--r-- | themes/PaperMod/layouts/_default/terms.html | 27 |
9 files changed, 334 insertions, 0 deletions
diff --git a/themes/PaperMod/layouts/_default/_markup/render-image.html b/themes/PaperMod/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..1acb87d --- /dev/null +++ b/themes/PaperMod/layouts/_default/_markup/render-image.html @@ -0,0 +1 @@ +<img loading="lazy" src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}" {{ end }} /> diff --git a/themes/PaperMod/layouts/_default/archives.html b/themes/PaperMod/layouts/_default/archives.html new file mode 100644 index 0000000..435d2a1 --- /dev/null +++ b/themes/PaperMod/layouts/_default/archives.html @@ -0,0 +1,49 @@ +{{- define "main" }} + +<header class="page-header"> + <h1>{{ .Title }}</h1> + {{- if .Description }} + <div class="post-description"> + {{ .Description }} + </div> + {{- end }} +</header> + +{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} + +{{- if .Site.Params.ShowAllPagesInArchive }} +{{- $pages = site.RegularPages }} +{{- end }} + +{{- range $pages.GroupByPublishDate "2006" }} +{{- if ne .Key "0001" }} +<div class="archive-year"> + <h2 class="archive-year-header"> + {{- replace .Key "0001" "" }}<sup class="archive-count"> {{ len .Pages }}</sup> + </h2> + {{- range .Pages.GroupByDate "January" }} + <div class="archive-month"> + <h3 class="archive-month-header">{{- .Key }}<sup class="archive-count"> {{ len .Pages }}</sup></h3> + <div class="archive-posts"> + {{- range .Pages }} + {{- if eq .Kind "page" }} + <div class="archive-entry"> + <h3 class="archive-entry-title"> + {{- .Title | markdownify }} + {{- if .Draft }}<sup><span class="entry-isdraft"> [draft]</span></sup>{{- end }} + </h3> + <div class="archive-meta"> + {{- partial "post_meta.html" . -}} + </div> + <a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a> + </div> + {{- end }} + {{- end }} + </div> + </div> + {{- end }} +</div> +{{- end }} +{{- end }} + +{{- end }}{{/* end main */}} diff --git a/themes/PaperMod/layouts/_default/baseof.html b/themes/PaperMod/layouts/_default/baseof.html new file mode 100644 index 0000000..6dfe741 --- /dev/null +++ b/themes/PaperMod/layouts/_default/baseof.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html lang="{{ .Site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}"> + +<head> + {{- partial "head.html" . }} +</head> + +<body class=" +{{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}} +{{- print "list" -}} +{{- end -}} +{{- if eq $.Site.Params.defaultTheme `dark` -}} +{{- print " dark" }} +{{- end -}} +" id="top"> + {{- partialCached "header.html" . .Page -}} + <main class="main"> + {{- block "main" . }}{{ end }} + </main> + {{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}} +</body> + +</html> diff --git a/themes/PaperMod/layouts/_default/index.json b/themes/PaperMod/layouts/_default/index.json new file mode 100644 index 0000000..2c86f7c --- /dev/null +++ b/themes/PaperMod/layouts/_default/index.json @@ -0,0 +1,7 @@ +{{- $.Scratch.Add "index" slice -}} +{{- range .Site.RegularPages -}} + {{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) }} + {{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}} + {{- end }} +{{- end -}} +{{- $.Scratch.Get "index" | jsonify -}} diff --git a/themes/PaperMod/layouts/_default/list.html b/themes/PaperMod/layouts/_default/list.html new file mode 100644 index 0000000..0cc1ad9 --- /dev/null +++ b/themes/PaperMod/layouts/_default/list.html @@ -0,0 +1,89 @@ +{{- define "main" }} + +{{- if (and .Site.Params.profileMode.enabled .IsHome) }} +{{- partial "index_profile.html" . }} +{{- else }} {{/* if not profileMode */}} + +{{- if not .IsHome | and .Title }} +<header class="page-header"> + {{- partial "breadcrumbs.html" . }} + <h1>{{ .Title }}</h1> + {{- if .Description }} + <div class="post-description"> + {{ .Description | markdownify }} + </div> + {{- end }} +</header> +{{- end }} + +{{- if .Content }} +<div class="post-content"> + {{- if not (.Param "disableAnchoredHeadings") }} + {{- partial "anchored_headings.html" .Content -}} + {{- else }}{{ .Content }}{{ end }} +</div> +{{- end }} + +{{- $pages := union .RegularPages .Sections }} + +{{- if .IsHome }} +{{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }} +{{- end }} + +{{- $paginator := .Paginate $pages }} + +{{- if and .IsHome .Site.Params.homeInfoParams (eq $paginator.PageNumber 1) }} +{{- partial "home_info.html" . }} +{{- end }} + +{{- $term := .Data.Term }} +{{- range $index, $page := $paginator.Pages }} + +{{- $class := "post-entry" }} + +{{- $user_preferred := or .Site.Params.disableSpecial1stPost .Site.Params.homeInfoParams }} +{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) (not $user_preferred)) }} +{{- $class = "first-entry" }} +{{- else if $term }} +{{- $class = "post-entry tag-entry" }} +{{- end }} + +<article class="{{ $class }}"> + {{- $isHidden := (.Site.Params.cover.hidden | default .Site.Params.cover.hiddenInList) }} + {{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }} + <header class="entry-header"> + <h2> + {{- .Title }} + {{- if .Draft }}<sup><span class="entry-isdraft"> [draft]</span></sup>{{- end }} + </h2> + </header> + {{- if (ne (.Param "hideSummary") true) }} + <section class="entry-content"> + <p>{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}</p> + </section> + {{- end }} + {{- if not (.Param "hideMeta") }} + <footer class="entry-footer"> + {{- partial "post_meta.html" . -}} + </footer> + {{- end }} + <a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a> +</article> +{{- end }} + +{{- if gt $paginator.TotalPages 1 }} +<footer class="page-footer"> + <nav class="pagination"> + {{- if $paginator.HasPrev }} + <a class="prev" href="{{ $paginator.Prev.URL | absURL }}">« {{ i18n "prev_page" }}</a> + {{- end }} + {{- if $paginator.HasNext }} + <a class="next" href="{{ $paginator.Next.URL | absURL }}">{{ i18n "next_page" }} »</a> + {{- end }} + </nav> +</footer> +{{- end }} + +{{- end }}{{/* end profileMode */}} + +{{- end }}{{- /* end main */ -}} diff --git a/themes/PaperMod/layouts/_default/rss.xml b/themes/PaperMod/layouts/_default/rss.xml new file mode 100644 index 0000000..eca41b7 --- /dev/null +++ b/themes/PaperMod/layouts/_default/rss.xml @@ -0,0 +1,50 @@ +{{- $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 "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"> + <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> + {{- with $.Site.Params.images }} + <image> + <url>{{ index . 0 | absURL }}</url> + <link>{{ index . 0 | absURL }}</link> + </image> + {{- end }} + <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} + <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} + <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} + <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} + <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} + <lastBuildDate>{{ .Date.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 }} + {{- if and (ne .Layout `search`) (ne .Layout `archives`) }} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} + <guid>{{ .Permalink }}</guid> + <description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description> + {{- if .Site.Params.ShowFullTextinRSS }} + <content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded> + {{- end }} + </item> + {{- end }} + {{ end }} + </channel> +</rss> diff --git a/themes/PaperMod/layouts/_default/search.html b/themes/PaperMod/layouts/_default/search.html new file mode 100644 index 0000000..2349587 --- /dev/null +++ b/themes/PaperMod/layouts/_default/search.html @@ -0,0 +1,29 @@ +{{- define "main" }} + +<header class="page-header"> + <h1>{{- (printf "%s " .Title ) | htmlUnescape -}} + <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" + stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> + <circle cx="11" cy="11" r="8"></circle> + <line x1="21" y1="21" x2="16.65" y2="16.65"></line> + </svg> + </h1> + {{- if .Description }} + <div class="post-description"> + {{ .Description }} + </div> + {{- end }} + {{- if not (.Param "hideMeta") }} + <div class="post-meta"> + {{- partial "translation_list.html" . -}} + </div> + {{- end }} +</header> + +<div id="searchbox"> + <input id="searchInput" autofocus placeholder="{{ .Params.placeholder | default (printf "%s ↵" .Title) }}" + aria-label="search" type="search" autocomplete="off"> + <ul id="searchResults" aria-label="search results"></ul> +</div> + +{{- end }}{{/* end main */}} diff --git a/themes/PaperMod/layouts/_default/single.html b/themes/PaperMod/layouts/_default/single.html new file mode 100644 index 0000000..1d983fd --- /dev/null +++ b/themes/PaperMod/layouts/_default/single.html @@ -0,0 +1,59 @@ +{{- define "main" }} + +<article class="post-single"> + <header class="post-header"> + {{ partial "breadcrumbs.html" . }} + <h1 class="post-title"> + {{ .Title }} + {{- if .Draft }}<sup><span class="entry-isdraft"> [draft]</span></sup>{{- end }} + </h1> + {{- if .Description }} + <div class="post-description"> + {{ .Description }} + </div> + {{- end }} + {{- if not (.Param "hideMeta") }} + <div class="post-meta"> + {{- partial "post_meta.html" . -}} + {{- partial "translation_list.html" . -}} + {{- partial "edit_post.html" . -}} + {{- partial "post_canonical.html" . -}} + </div> + {{- end }} + </header> + {{- $isHidden := .Params.cover.hidden | default .Site.Params.cover.hiddenInSingle | default .Site.Params.cover.hidden }} + {{- partial "cover.html" (dict "cxt" . "IsHome" false "isHidden" $isHidden) }} + {{- if (.Param "ShowToc") }} + {{- partial "toc.html" . }} + {{- end }} + + {{- if .Content }} + <div class="post-content"> + {{- if not (.Param "disableAnchoredHeadings") }} + {{- partial "anchored_headings.html" .Content -}} + {{- else }}{{ .Content }}{{ end }} + </div> + {{- end }} + + <footer class="post-footer"> + {{- if .Params.tags }} + <ul class="post-tags"> + {{- range ($.GetTerms "tags") }} + <li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> + {{- end }} + </ul> + {{- end }} + {{- if (.Param "ShowPostNavLinks") }} + {{- partial "post_nav_links.html" . }} + {{- end }} + {{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true)) }} + {{- partial "share_icons.html" . -}} + {{- end }} + </footer> + + {{- if (.Param "comments") }} + {{- partial "comments.html" . }} + {{- end }} +</article> + +{{- end }}{{/* end main */}} diff --git a/themes/PaperMod/layouts/_default/terms.html b/themes/PaperMod/layouts/_default/terms.html new file mode 100644 index 0000000..d5a9e66 --- /dev/null +++ b/themes/PaperMod/layouts/_default/terms.html @@ -0,0 +1,27 @@ +{{- define "main" }} + +{{- if .Title }} +<header class="page-header"> + <h1>{{ .Title }}</h1> + {{- if .Description }} + <div class="post-description"> + {{ .Description }} + </div> + {{- end }} +</header> +{{- end }} + +<ul class="terms-tags"> + {{- $type := .Type }} + {{- range $key, $value := .Data.Terms.Alphabetical }} + {{- $name := .Name }} + {{- $count := .Count }} + {{- with $.Site.GetPage (printf "/%s/%s" $type $name) }} + <li> + <a href="{{ .Permalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a> + </li> + {{- end }} + {{- end }} +</ul> + +{{- end }}{{/* end main */ -}} |