diff options
Diffstat (limited to 'themes/default/layouts/_default')
38 files changed, 902 insertions, 871 deletions
diff --git a/themes/default/layouts/_default/_markup/render-codeblock-mathml.html b/themes/default/layouts/_default/_markup/render-codeblock-mathml.html new file mode 100644 index 0000000..f6e5b61 --- /dev/null +++ b/themes/default/layouts/_default/_markup/render-codeblock-mathml.html @@ -0,0 +1,18 @@ +{{- $caption := default "Math Render" .Attributes.caption -}} +{{- $ordinal := add .Ordinal 1 -}} +{{- $hash := print (truncate 3 "" (sha256 .Inner)) (truncate 3 "" (sha256 .Page.RelPermalink)) "-" $ordinal -}} +{{- $id := print "math:" $hash | safeURL -}} + +<math-ml> + <figure id="{{ $id }}"> + <figure> + {{- with $math := .Inner -}} + {{- $math | safeHTML -}} + {{- end -}} + </figure> + <figcaption> + <a href="#{{ $id }}">({{ $ordinal }})</a> + {{ $caption | markdownify }} + </figcaption> + </figure> +</math-ml> diff --git a/themes/default/layouts/_default/_markup/render-codeblock.html b/themes/default/layouts/_default/_markup/render-codeblock.html index f18f0d3..ab9a786 100644 --- a/themes/default/layouts/_default/_markup/render-codeblock.html +++ b/themes/default/layouts/_default/_markup/render-codeblock.html @@ -1,22 +1,25 @@ -{{- $caption := .Attributes.caption -}} -{{- $type := .Type | default "text" -}} -{{- $options := .Attributes.options | default "default=1" -}} -{{- $hash := print (truncate 8 "" (sha256 .Inner)) .Ordinal -}} -{{- $id := print "code-block-" $hash -}} +{{- $caption := .Attributes.caption -}} +{{- $type := .Type | default "text" -}} +{{- $options := .Attributes.options | default "default=1" -}} +{{- $hash := print (truncate 3 "" (sha256 .Inner)) (truncate 3 "" (sha256 .Page.RelPermalink)) .Ordinal -}} +{{- $id := print "code-block:" $hash | safeURL -}} +{{- $highlight := highlight .Inner $type (print $options ",lineAnchors=" "code-line:" $hash) -}} <code-block id="{{ $id }}" {{ if in (lower $options) "linenos" }}data-lines=""{{ end }}> <header> <language-label> <a href="#{{ $id }}">{{ $type }}</a> </language-label> - <button hidden=""> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/copy.svg")) }} - <span>Copy</span> - </button> </header> - {{ highlight .Inner $type (print $options ",lineAnchors=" "code-line-" $hash) }} + <code-content contenteditable="true" spellcheck="false"> + {{- replace $highlight + `class="lnlinks"` + `contenteditable="false" class="lnlinks"` + | safeHTML + -}} + </code-content> </code-block> -{{ with $caption }} +{{- with $caption -}} <footer>{{ . | markdownify }}</footer> -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/_markup/render-heading.html b/themes/default/layouts/_default/_markup/render-heading.html index 37eddb2..86b8e35 100644 --- a/themes/default/layouts/_default/_markup/render-heading.html +++ b/themes/default/layouts/_default/_markup/render-heading.html @@ -1,6 +1,9 @@ -<h{{ .Level }} id="{{ .Anchor | safeURL }}"> - <a - title="{{ .Text | safeHTML }}" - href="#{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} +{{- $text := .Text -}} +{{- $hash := print (truncate 2 "" (sha256 .Page.RelPermalink)) (truncate 2 "" (sha256 $text)) -}} +{{- $id := print "heading:" $hash ":" .Anchor -}} + +<h{{ .Level }} id="{{ $id | safeURL }}"> + <a title="{{ $text | safeHTML }}" href="#{{ $id | safeURL }}"> + {{ $text | safeHTML }} </a> </h{{ .Level }}> diff --git a/themes/default/layouts/_default/_markup/render-image.html b/themes/default/layouts/_default/_markup/render-image.html index b98efdf..04bf931 100644 --- a/themes/default/layouts/_default/_markup/render-image.html +++ b/themes/default/layouts/_default/_markup/render-image.html @@ -1,97 +1,92 @@ -{{- $source := $.Destination | safeURL -}} -{{- $public := print "public/" $source -}} -{{- $local := "" -}} {{- $cache := "" -}} -{{- $exists := "" -}} {{- $width := "" -}} {{- $height := "" -}} {{- $srcset := "" -}} {{- $colors := "" -}} +{{- $type := "" -}} +{{- $source := $.Destination | safeURL -}} +{{- $public := print "public/" $source -}} +{{- $fetch := print (urls.Parse $source).Scheme "://" (urls.Parse $source).Host (urls.Parse $source).RequestURI -}} {{- $figcaption := "Image/Picture" -}} {{- $orientation := "landscape" -}} {{- $dimensions := "600x360" -}} {{- $author := .Page.Section -}} {{- $relURL := strings.TrimPrefix .Page.Site.BaseURL .Page.Permalink -}} {{- $immutable := print ($relURL | humanize | urlize) "-" ($source | sha256 | truncate 8 "") -}} -{{- $fileCache := print (partial "function-paths.html").media "/" $author "/" $immutable -}} -{{- $cached := and (fileExists (print "public/" $fileCache ".webp")) (fileExists (print "public/" $fileCache (path.Ext $source))) -}} +{{- $storage := print $author "/media/" $immutable -}} +{{- $cached := fileExists (print "public/" $storage ".webp") -}} + +{{- $moderns := slice ".webp" ".avif" -}} +{{- $fallbacks := slice ".png" ".jpg" ".gif" ".jpeg" ".svg" ".apng" ".jfif" ".pjpeg" ".pjp" -}} +{{- $mimes := slice "image/avif" "image/webp" "image/apng" "image/gif" "image/jpeg" "image/png" "image/svg+xml" -}} {{- if not $cached -}} - {{- with $remote := cond (default true $.Page.Site.Params.site.offline) false (resources.GetRemote $source) -}} + {{- with $remote := cond (default true $.Page.Site.Params.site.offline) false (resources.GetRemote $fetch) -}} {{- with .Err -}} {{- if fileExists $public -}} - {{- $local = resources.Get $public -}} - {{- with $local -}} - {{- $local = .Content | resources.FromString (print (partial "function-paths.html").media "/" $author "/" (path.Base .)) -}} + {{- with $local := resources.Get $public -}} + {{- $local = .Content | resources.FromString (print $storage (path.Base .)) -}} + {{- $local = .Fit (print $dimensions " webp") -}} + {{- $local = $local | resources.Copy (print $storage ".webp") -}} + {{- $srcset = $local.Permalink -}} + {{- $local = .Fit $dimensions -}} + {{- $local = $local | resources.Copy (print $storage (path.Ext $local)) -}} + {{- $width = $local.Width -}} + {{- $height = $local.Height -}} + {{- $colors = $local.Colors -}} + {{- $cache = $local.Permalink -}} {{- end -}} {{- $source = print ("" | absURL) $source -}} {{- else -}} - {{- $404image := resources.Get "data/media/404.png" -}} - {{- with $404image -}} - {{- $width = .Width -}} - {{- $height = .Height -}} + {{- with $404image := resources.Get "data/media/404.png" -}} + {{- $width = $404image.Width -}} + {{- $height = $404image.Height -}} + {{- $source = $404image.Permalink -}} {{- end -}} - {{- $source = $404image.Permalink -}} {{- end -}} {{- else -}} - {{- $cache = .Content | resources.FromString (print (partial "function-paths.html").media "/" $author "/" (path.Base .)) -}} + {{- with $cache = $remote.Content | resources.FromString (print $storage (path.Base $remote)) -}} + {{- $cache = .Fit (print $dimensions " webp") -}} + {{- $cache = $cache | resources.Copy (print $storage ".webp") -}} + {{- $srcset = $cache.Permalink -}} + {{- $cache = .Fit $dimensions -}} + {{- $cache = $cache | resources.Copy (print $storage (path.Ext $cache)) -}} + {{- $width = $cache.Width -}} + {{- $height = $cache.Height -}} + {{- $colors = $cache.Colors -}} + {{- $cache = $cache.Permalink -}} + {{- end -}} {{- end -}} {{- end -}} {{- else -}} - {{- $exists = resources.Get (print "public/" $fileCache (path.Ext $source)) -}} - {{- $exists = $exists.Content | resources.FromString (print (partial "function-paths.html").media "/" $author "/" (path.Base $exists)) -}} -{{- end -}} - -{{- with $local }} - {{- $local = .Fit (print $dimensions " webp") }} - {{- $local = $local | resources.Copy (print (partial "function-paths.html").media "/" $author "/" $immutable ".webp") }} - {{- $srcset = $local.Permalink -}} - {{- $local = .Fit $dimensions }} - {{- $local = $local | resources.Copy (print (partial "function-paths.html").media "/" $author "/" $immutable (path.Ext $local)) }} - {{- $width = $local.Width -}} - {{- $height = $local.Height -}} - {{- $colors = $local.Colors -}} - {{- $writeToFile := $local.Permalink }} -{{- end }} - -{{- with $cache }} - {{- $cache = .Fit (print $dimensions " webp") }} - {{- $cache = $cache | resources.Copy (print $author "/media/" $immutable ".webp") }} - {{- $srcset = $cache.Permalink -}} - {{- $cache = .Fit $dimensions }} - {{- $cache = $cache | resources.Copy (print (partial "function-paths.html").media "/" $author "/" $immutable (path.Ext $cache)) }} - {{- $width = $cache.Width -}} - {{- $height = $cache.Height -}} - {{- $colors = $cache.Colors -}} - {{- $cache = $cache.Permalink }} -{{- end -}} - -{{- with $exists }} - {{- if fileExists (print "public/" $fileCache ".webp") -}} - {{- $srcset = print "/" $fileCache ".webp" -}} + {{- with $cache = resources.Get (print "public/" $storage ".webp") -}} + {{- $width = $cache.Width -}} + {{- $height = $cache.Height -}} + {{- $colors = $cache.Colors -}} + {{- $type = $cache.MediaType -}} + {{- $srcset = print ("" | absURL) "/" $storage ".webp" -}} {{- end -}} - {{- if fileExists (print "public/" $author "/media/" $immutable ".webp") -}} - {{- $srcset = print "/" $author "/media/" $immutable ".webp" -}} + {{- range $extension := $fallbacks -}} + {{- with resources.Get (print "public/" $storage $extension) -}} + {{- $cache = print ("" | absURL) "/" $storage $extension -}} + {{- break -}} + {{- end -}} {{- end -}} - {{- $width = .Width -}} - {{- $height = .Height -}} - {{- $colors = .Colors -}} - {{- $cache = .Permalink }} {{- end -}} {{- if lt $width $height -}} {{- $orientation = "portrait" -}} {{- end -}} -{{- with $.Title -}} - {{- $figcaption = . | markdownify -}} +{{- with $caption := $.Title -}} + {{- $figcaption = $caption | markdownify -}} {{ end }} {{- /* This comment removes trailing newlines and white spaces. */ -}} <figure> <a data-orientation="{{ $orientation }}" href="{{ $source }}"> <picture> {{- with $srcset }} - <source srcset="{{ $srcset }}" type="image/webp" /> + <source srcset="{{ $srcset }}" type="{{ or $type "image/webp" }}" /> {{- end }} <img loading="lazy" @@ -101,7 +96,7 @@ width="{{ $width }}" height="{{ $height }}" {{ printf `style="` | safeHTMLAttr -}} - {{- partial "styles-image-gradient.html" $colors | safeHTMLAttr -}} + {{- partial "image-gradient.css.html" $colors | safeHTMLAttr -}} {{- printf `"` | safeHTMLAttr }} /> </picture> diff --git a/themes/default/layouts/_default/baseof.html b/themes/default/layouts/_default/baseof.html index ddd2780..c277115 100644 --- a/themes/default/layouts/_default/baseof.html +++ b/themes/default/layouts/_default/baseof.html @@ -1,5 +1,11 @@ -{{- $modified := partial "function-page-modified.html" . -}} +{{- $modified := partial "function-page-modified.html" + (dict + "Context" . + "Disable" true + ) +-}} +{{- if $modified -}} <!DOCTYPE html> <html lang="en-us" @@ -7,14 +13,15 @@ data-type="{{ .Page.Type }}" itemscope="" itemtype="http://schema.org/BlogPosting" + data-document="html" > <head> <title> {{- block "title" . -}}{{- end -}} - {{- partial "base-title.html" . -}} + {{- partial "head-title.html" . -}} </title> - <meta name="description" content="{{- partial "base-description.html" . -}}" /> - {{- partial "base-head.html" . -}} + <meta name="description" content="{{- partial "head-description.html" . -}}" /> + {{- partial "head.html" . -}} {{- block "styles" . -}}{{- end -}} </head> <body> @@ -22,23 +29,27 @@ <a href="#main">Skip to main content</a> </skip-link> - <column-left> + <column-base position="left"> {{- partial "navigator-left.html" . -}} - </column-left> + </column-base> - <column-middle> + <column-base position="middle"> + {{- block "header" . -}}{{- end -}} <main id="main"> {{- block "middle" . -}} <footer>Silence is golden.</footer> {{- end -}} - {{- partial "base-footer.html" . -}} </main> - </column-middle> + {{- block "footer" . -}} + {{- partial "footer.html" . -}} + {{- end -}} + </column-base> - <column-right> + <column-base position="right"> {{- block "right" . -}} <footer>Silence is golden.</footer> {{- end -}} - </column-right> + </column-base> </body> </html> +{{- end -}} diff --git a/themes/default/layouts/_default/baseof.json b/themes/default/layouts/_default/baseof.json index b2d7a9f..e1203cc 100644 --- a/themes/default/layouts/_default/baseof.json +++ b/themes/default/layouts/_default/baseof.json @@ -1,5 +1,12 @@ -{{- $modified := partial "function-page-modified.html" . -}} +{{- $modified := partial "function-page-modified.html" + (dict + "Context" . + "Disable" true + ) +-}} -{{- block "main" . -}} -"Silence is golden." +{{- if $modified -}} + {{- block "main" . -}} + "Silence is golden." + {{- end -}} {{- end -}} diff --git a/themes/default/layouts/_default/baseof.txt b/themes/default/layouts/_default/baseof.txt index 55f860c..c354667 100644 --- a/themes/default/layouts/_default/baseof.txt +++ b/themes/default/layouts/_default/baseof.txt @@ -1,5 +1,12 @@ -{{- $modified := partial "function-page-modified.html" . -}} +{{- $modified := partial "function-page-modified.html" + (dict + "Context" . + "Disable" true + ) +-}} -{{- block "main" . -}} -Silence is golden. +{{- if $modified -}} + {{- block "main" . -}} + Silence is golden. + {{- end -}} {{- end -}} diff --git a/themes/default/layouts/_default/baseof.xml b/themes/default/layouts/_default/baseof.xml index f804253..73f129f 100644 --- a/themes/default/layouts/_default/baseof.xml +++ b/themes/default/layouts/_default/baseof.xml @@ -1,8 +1,13 @@ -{{- $modified := partial "function-page-modified.html" . -}} +{{- $modified := partial "function-page-modified.html" + (dict + "Context" . + "Disable" true + ) +-}} +{{- if $modified -}} {{- block "main" . -}} -{{- printf `<?xml version="1.0" encoding="utf-8" standalone="yes"?>` | safeHTML -}} -<root> -Silence is golden. -</root> +{{- printf `<?xml version="1.0" encoding="utf-8" standalone="yes"?>%s` "\n" | safeHTML -}} +<root>Silence is golden.</root> +{{- end -}} {{- end -}} diff --git a/themes/default/layouts/_default/home.archives.html b/themes/default/layouts/_default/home.archives.html new file mode 100644 index 0000000..f443583 --- /dev/null +++ b/themes/default/layouts/_default/home.archives.html @@ -0,0 +1,67 @@ +{{- define "title" -}}Archives — {{ end -}} +{{- define "description" -}}An archive of all items — {{ end -}} +{{- define "styles" -}} +<style> + {{ partial "navigator.css.html" (dict "Link" "/archives/") | safeCSS }} +</style> +{{- end -}} + +{{- define "header" -}} + {{- partial "navigator-middle.html" + (dict + "Context" . + "IconLabel" "Back" + "Id" "back" + "Title" "Archives" + "Icon" "arrow-left" + "Subtitle" (print (partial "count.html" .) " " "Total") + "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/") + ) + -}} +{{- end -}} + +{{- define "middle" -}} + <archive-list> + <time-line> + {{ range (.Paginator.Pages.GroupByDate "2006") }} + {{ range (first 1 .Pages) }} + <h1>{{ .Date | time.Format "2006" }}</h1> + {{ end }} + <ul> + {{ range .Pages }} + {{- $author := .Page.Section -}} + <li> + <a + title="{{ partial "meta-title.html" . }}" + href="{{ .Permalink }}#{{ partial "card-id.html" . }}" + > + <code> + <time + data-type="disabled" + datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" + title="{{ .Date | time.Format "Posted: Monday January 2 2006 at 15:04:05 MST" }}" + > + {{ .Date | time.Format "02 Jan" }} + </time> + </code> + <section> + <h2>{{ partial "meta-title.html" . }}</h2> + <p>@{{ or .Params.feed.domain $author }}</p> + </section> + </a> + </li> + {{ end }} + </ul> + {{ end }} + </time-line> + </archive-list> +{{- end -}} + +{{- define "footer" -}} + {{- partial "pagination.html" . -}} + {{- partial "footer.html" . -}} +{{- end -}} + +{{- define "right" -}} + {{- partial "navigator-right.html" . -}} +{{- end -}} diff --git a/themes/default/layouts/_default/home.authors.html b/themes/default/layouts/_default/home.authors.html index c4051bb..0662285 100644 --- a/themes/default/layouts/_default/home.authors.html +++ b/themes/default/layouts/_default/home.authors.html @@ -1,41 +1,41 @@ -{{ define "title" }}Authors — {{ end }} -{{ define "description" }}This page contains a list of all authors — {{ end }} -{{ define "styles" }} +{{- define "title" -}}Authors — {{ end -}} +{{- define "description" -}}A list of all authors — {{ end -}} +{{- define "styles" -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/authors/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/authors/") | safeCSS }} </style> -{{ end }} +{{- end -}} -{{ define "middle" }} - - {{- partial "generate-authors" . -}} - - {{ partial "navigator-middle.html" +{{- define "header" -}} + {{- partial "navigator-middle.html" (dict "Title" "Authors" - "Subtitle" (partial "count-authors.html" .) + "Subtitle" (print (partial "count-authors.html" .) " " "Total") "Icon" "arrow-left" "IconLabel" "Back" "Href" "/" "Id" "back" "Context" . ) - }} + -}} +{{- end -}} - {{ $authors := partial "function-authors-slice.html" . }} +{{- define "middle" -}} + {{- partial "generate-authors" . -}} + + {{- $authors := partial "function-authors-slice.html" . -}} - {{- range $author := shuffle $authors -}} - {{ $data := index $.Site.Data $author | default "default" }} + {{- range $author := $authors -}} + {{- $data := index $.Site.Data.authors $author -}} {{- $date := (index (first 1 (where $.Site.Pages.ByDate.Reverse "Section" $author)) 0).Date -}} {{- partial "author-card.html" (dict "Data" $data "Date" $date ) -}} - {{ end }} - -{{ end }} + {{- end -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/home.authors.section.html b/themes/default/layouts/_default/home.authors.section.html index 8b868f9..b0b1161 100644 --- a/themes/default/layouts/_default/home.authors.section.html +++ b/themes/default/layouts/_default/home.authors.section.html @@ -1,11 +1,20 @@ {{- $authors := partial "function-authors-slice.html" . -}} -{{- range $author := first 3 (shuffle $authors) -}} -{{- $data := index $.Site.Data $author | default "default" -}} -{{- $date := (index (first 1 (where $.Site.Pages.ByDate.Reverse "Section" $author)) 0).Date -}} -{{- partial "author-card.html" (dict - "Data" $data - "Date" $date +{{- $modified := partial "function-page-modified.html" + (dict + "Context" . + "Disable" true ) -}} + +{{- if $modified -}} + {{- range $author := first 3 $authors -}} + {{- $data := index $.Site.Data.authors $author -}} + {{- $date := (index (first 1 (where $.Site.Pages.ByDate.Reverse "Section" $author)) 0).Date -}} + {{- partial "author-card.html" (dict + "Data" $data + "Date" $date + ) + -}} + {{- end -}} {{- end -}} diff --git a/themes/default/layouts/_default/home.browserconfig.xml b/themes/default/layouts/_default/home.browserconfig.xml deleted file mode 100644 index 67bc7a3..0000000 --- a/themes/default/layouts/_default/home.browserconfig.xml +++ /dev/null @@ -1,13 +0,0 @@ -{{- $icon := resources.Get .Site.Params.webmanifest.logo -}} - -{{- $mstile150 := $icon.Fit "150x150" -}} - -<?xml version="1.0" encoding="utf-8"?> -<browserconfig> - <msapplication> - <tile> - <square150x150logo src="{{ $mstile150.Permalink }}"/> - <TileColor>#da532c</TileColor> - </tile> - </msapplication> -</browserconfig> diff --git a/themes/default/layouts/_default/home.history.html b/themes/default/layouts/_default/home.history.html deleted file mode 100644 index 5765826..0000000 --- a/themes/default/layouts/_default/home.history.html +++ /dev/null @@ -1,57 +0,0 @@ -{{ define "title" }}Message History — {{ end }} -{{ define "description" }}This page contains an archive of all messages — {{ end }} -{{ define "styles" }} -<style> - {{ partial "styles-navigator.html" (dict "Link" "/archives/messages/") | safeCSS }} -</style> -{{ end }} - -{{ define "middle" }} - - {{ partial "navigator-middle.html" - (dict - "Title" "History" - "Subtitle" (partial "count-total-messages.html" .) - "Icon" "arrow-left" - "IconLabel" "Back" - "Href" "/" - "Id" "back" - "Context" . - ) - }} - - {{- $author := partial "function-authors-data.html" . -}} - - <history-archive> - <item-list> - {{ range (.Paginator.Pages.GroupByDate "2006") }} - {{ range (first 1 .Pages) }} - <h1>{{ .Date.Format "2006" }}</h1> - {{ end }} - <ul> - {{ range .Pages }} - <li> - <a - title="{{ partial "meta-title.html" . }}" - href="{{ .RelPermalink }}#{{ partial "card-id.html" . }}" - > - <span> - <code title="{{ .Date | time.Format "Posted: Monday, January 2, 2006 at 15:04:05 MST" }}">{{ .Date.Format "02 Jan" }}</code> - </span> - <span>{{ partial "meta-title.html" . }}</span> - <span>@{{ $author.user }}</span> - </a> - </li> - {{ end }} - </ul> - {{ end }} - </item-list> - </history-archive> - - {{ partial "pagination.html" . }} - -{{ end }} - -{{ define "right" }} - {{- partial "navigator-right.html" . -}} -{{ end }} diff --git a/themes/default/layouts/_default/home.records.html b/themes/default/layouts/_default/home.records.html deleted file mode 100644 index 137c673..0000000 --- a/themes/default/layouts/_default/home.records.html +++ /dev/null @@ -1,52 +0,0 @@ -{{ define "title" }}Tags Archive — {{ end }} -{{ define "description" }}This page contains an archive of all tags — {{ end }} -{{ define "styles" }} -<style> - {{ partial "styles-navigator.html" (dict "Link" "/archives/tags/") | safeCSS }} -</style> -{{ end }} - -{{ define "middle" }} - - {{ partial "navigator-middle.html" - (dict - "Title" "Records" - "Subtitle" (partial "count-tags.html" .) - "Icon" "arrow-left" - "IconLabel" "Back" - "Href" "/" - "Id" "back" - "Context" . - ) - }} - - {{- $author := partial "function-authors-data.html" . -}} - - <records-archive> - <item-list> - {{ range (.Paginator.Pages.GroupByDate "2006") }} - {{ range (first 1 .Pages) }} - <h1>{{ .Date.Format "2006" }}</h1> - {{ end }} - <ul> - {{ range .Pages }} - <li> - <span> - <code title="{{ .Date | time.Format "Posted: Monday, January 2, 2006 at 15:04:05 MST" }}">{{ .Date.Format "02 Jan" }}</code> - </span> - <span>{{ partial "meta-tags.html" . }} — {{ partial "meta-title.html" . }}</span> - <span>@{{ $author.user }}</span> - </li> - {{ end }} - </ul> - {{ end }} - </item-list> - </records-archive> - - {{ partial "pagination.html" . }} - -{{ end }} - -{{ define "right" }} - {{- partial "navigator-right.html" . -}} -{{ end }} diff --git a/themes/default/layouts/_default/home.settings.html b/themes/default/layouts/_default/home.settings.html new file mode 100644 index 0000000..84e8080 --- /dev/null +++ b/themes/default/layouts/_default/home.settings.html @@ -0,0 +1,32 @@ +{{- define "title" -}}Settings — {{ end -}} +{{- define "description" -}}A list of all interface settings — {{ end -}} +{{- define "styles" -}} +<style> + {{ partial "navigator.css.html" (dict "Link" "/settings/") | safeCSS }} +</style> +{{- end -}} + +{{- define "header" -}} + {{- partial "navigator-middle.html" + (dict + "Context" . + "IconLabel" "Back" + "Id" "back" + "Title" "Settings" + "Icon" "arrow-left" + "Subtitle" "Interface" + "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/") + ) + -}} +{{- end -}} + +{{- define "middle" -}} +{{- end -}} + +{{- define "footer" -}} + {{- partial "footer.html" . -}} +{{- end -}} + +{{- define "right" -}} + {{- partial "navigator-right.html" . -}} +{{- end -}} diff --git a/themes/default/layouts/_default/home.sources.html b/themes/default/layouts/_default/home.sources.html index 4d485e7..32f7822 100644 --- a/themes/default/layouts/_default/home.sources.html +++ b/themes/default/layouts/_default/home.sources.html @@ -1,48 +1,53 @@ -{{ define "title" }}Sources — {{ end }} -{{ define "description" }}This page contains a list of all source files — {{ end }} -{{ define "styles" }} +{{- define "title" -}}Sources — {{ end -}} +{{- define "description" -}}A list of all sources — {{ end -}} +{{- define "styles" -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/sources/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/sources/") | safeCSS }} </style> -{{ end }} +{{- end -}} -{{ define "middle" }} +{{- define "header" -}} + {{- $_default := readDir (print "/themes/default/layouts/_default") -}} + {{- $_markup := readDir (print "/themes/default/layouts/_default/_markup") -}} + {{- $partials := readDir (print "/themes/default/layouts/partials") -}} + {{- $shortcodes := readDir (print "/themes/default/layouts/shortcodes") -}} - {{ $_default := readDir (print "/themes/default/layouts/_default") }} - {{ $_markup := readDir (print "/themes/default/layouts/_default/_markup") }} - {{ $partials := readDir (print "/themes/default/layouts/partials") }} - {{ $shortcodes := readDir (print "/themes/default/layouts/shortcodes") }} - - {{ $fileCount := add + {{- $fileCount := add (add (sub (len $_default) 1) (len $_markup)) (add (len $partials) (len $shortcodes)) - }} + -}} - {{ partial "navigator-middle.html" + {{- partial "navigator-middle.html" (dict "Title" "Sources" - "Subtitle" (print $fileCount " " "Files") + "Subtitle" (print $fileCount " " "Total") "Icon" "arrow-left" "IconLabel" "Back" "Href" "/" "Id" "back" "Context" . ) - }} + -}} +{{- end -}} + +{{- define "middle" -}} + {{- $_default := readDir (print "/themes/default/layouts/_default") -}} + {{- $_markup := readDir (print "/themes/default/layouts/_default/_markup") -}} + {{- $partials := readDir (print "/themes/default/layouts/partials") -}} + {{- $shortcodes := readDir (print "/themes/default/layouts/shortcodes") -}} <source-files> <item-list> - <h1>Defaults</h1> <ul> {{ range sort $_default ".ModTime" "desc" }} {{ if not .IsDir }} <li> - <a download title="{{ .Name }}" href="{{ $.Site.BaseURL }}/sources/files/_default/{{ .Name }}"> + <a download="" title="{{ .Name }}" href="{{ "sources/files/_default" | relURL }}/{{ .Name }}"> <span><code>{{- .ModTime | time.Format "2006-01-02 15:04 MST" }}</code></span> <span><code>{{ .Name }}</code></span> <span><code>{{ .Size -}}</code></span> @@ -57,7 +62,7 @@ {{ range sort $_markup ".ModTime" "desc" }} {{ if not .IsDir }} <li> - <a download title="{{ .Name }}" href="{{ $.Site.BaseURL }}/sources/files/_default/_markup/{{ .Name }}"> + <a download="" title="{{ .Name }}" href="{{ "sources/files/_default/_markup" | relURL }}/{{ .Name }}"> <span><code>{{- .ModTime | time.Format "2006-01-02 15:04 MST" }}</code></span> <span><code>{{ .Name }}</code></span> <span><code>{{ .Size -}}</code></span> @@ -72,7 +77,7 @@ {{ range sort $partials ".ModTime" "desc" }} {{ if not .IsDir }} <li> - <a download title="{{ .Name }}" href="{{ $.Site.BaseURL }}/sources/files/partials/{{ .Name }}"> + <a download="" title="{{ .Name }}" href="{{ "sources/files/partials" | relURL }}/{{ .Name }}"> <span><code>{{- .ModTime | time.Format "2006-01-02 15:04 MST" }}</code></span> <span><code>{{ .Name }}</code></span> <span><code>{{ .Size -}}</code></span> @@ -87,7 +92,7 @@ {{ range sort $shortcodes ".ModTime" "desc" }} {{ if not .IsDir }} <li> - <a download title="{{ .Name }}" href="{{ $.Site.BaseURL }}/sources/files/shortcodes/{{ .Name }}"> + <a download="" title="{{ .Name }}" href="{{ "sources/files/shortcodes" | relURL }}/{{ .Name }}"> <span><code>{{- .ModTime | time.Format "2006-01-02 15:04 MST" }}</code></span> <span><code>{{ .Name }}</code></span> <span><code>{{ .Size -}}</code></span> @@ -101,19 +106,17 @@ <footer> <p> Canory Version: {{ "{{% version number %}}" | markdownify }} - · Dictionary Access by Paul Lutus: <a href="https://arachnoid.com/javascript/dictionary_access.js">GPLv2+ License</a> - · Feather Icons by Cole Bemis: <a href="https://github.com/feathericons/feather/blob/8b5d6802fa8fd1eb3924b465ff718d2fa8d61efe/LICENSE">MIT License</a> - · Tabler Icons by PaweÅ‚ Kuna: <a href="https://github.com/tabler/tabler-icons/blob/60f39297d0f785f2e8635faca6857b2260b2d164/LICENSE">MIT License</a> - · Instant Page by Alexandre Dieulot: <a href="https://github.com/instantpage/instant.page/blob/729e97d5b3245552e41d8f92ed03d08f1d62ea46/LICENSE">MIT License</a> - · Fixed Search by Heracles Papatheodorou: <a href="https://gist.github.com/Arty2/8b0c43581013753438a3d35c15091a9f#file-license-md">MIT License</a> - · Fuzzy Sort by Stephen Kamenar: <a href="https://github.com/farzher/fuzzysort/blob/e7f484a124f09bf3cb9a4db366a95457d962dbed/LICENSE">MIT License</a> + · Dictionary Access by Paul Lutus: <a href="https://arachnoid.com/javascript/dictionary_access.js">GPLv2+ Licence</a> + · Feather Icons by Cole Bemis: <a href="https://github.com/feathericons/feather/blob/8b5d6802fa8fd1eb3924b465ff718d2fa8d61efe/Licence">MIT Licence</a> + · Tabler Icons by PaweÅ‚ Kuna: <a href="https://github.com/tabler/tabler-icons/blob/60f39297d0f785f2e8635faca6857b2260b2d164/Licence">MIT Licence</a> + · Instant Page by Alexandre Dieulot: <a href="https://github.com/instantpage/instant.page/blob/729e97d5b3245552e41d8f92ed03d08f1d62ea46/Licence">MIT Licence</a> + · Fixed Search by Heracles Papatheodorou: <a href="https://gist.github.com/Arty2/8b0c43581013753438a3d35c15091a9f#file-Licence-md">MIT Licence</a> + · Fuzzy Sort by Stephen Kamenar: <a href="https://github.com/farzher/fuzzysort/blob/e7f484a124f09bf3cb9a4db366a95457d962dbed/Licence">MIT Licence</a> </p> </footer> - </source-files> +{{- end -}} -{{ end }} - -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/home.xslt.rss.xsl b/themes/default/layouts/_default/home.xslt.rss.xsl index e1299c5..587d119 100644 --- a/themes/default/layouts/_default/home.xslt.rss.xsl +++ b/themes/default/layouts/_default/home.xslt.rss.xsl @@ -6,102 +6,98 @@ xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="1.1" > - <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> + <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" /> <xsl:template match="/"> - <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" xml-data=""> + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" data-xml="" data-document="xhtml"> <head> - {{ printf `<title><xsl:value-of select="/rss/channel/title"/> Web Feed</title>` | safeHTML }} - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> - <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> - {{- partial "base-css.html" . -}} + {{ printf `<title><xsl:value-of select="/rss/channel/title" /> Web Feed</title>` | safeHTML }} + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> + {{- partial "head-css.html" . -}} + {{- partial "head-js.html" . -}} </head> <body> - <column-left> - </column-left> - <column-middle> - <main> + <column-base position="left"></column-base> + <column-base position="middle"> <nav> <icon-button> - <a onclick="window.history.go(-1); return false;"> + <a id="back" target="_self"> <xsl:choose> - <xsl:when test="/rss/channel/atom:link[@rel='previous']/@href"> - <xsl:attribute name="href"> - <xsl:value-of select="/rss/channel/atom:link[@rel='previous']/@href"/> - </xsl:attribute> - </xsl:when> - <xsl:otherwise> - <xsl:attribute name="href">/</xsl:attribute> - </xsl:otherwise> + <xsl:when test="/rss/channel/atom:link[@rel='previous']/@href"> + <xsl:attribute name="href"> + <xsl:value-of select="/rss/channel/atom:link[@rel='previous']/@href" /> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="href">/</xsl:attribute> + </xsl:otherwise> </xsl:choose> {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }} <small>Back</small> </a> </icon-button> <section> - <h2><xsl:value-of select="/rss/channel/title"/>'s Feed</h2> - <small>Web Feed Preview</small> + <h2><xsl:value-of select="/rss/channel/title" />'s Feed</h2> + <small>Web Feed Preview</small> </section> <xsl:if test="/rss/channel/atom:link[@rel='next']/@href"> - <icon-button> - <a> - <xsl:attribute name="href"> - <xsl:value-of select="/rss/channel/atom:link[@rel='next']/@href"/> - </xsl:attribute> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }} - <small>Next</small> - </a> - </icon-button> + <icon-button> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="/rss/channel/atom:link[@rel='next']/@href" /> + </xsl:attribute> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }} + <small>Next</small> + </a> + </icon-button> </xsl:if> {{ if .Site.Menus.main }} {{ range .Site.Menus.main }} - <icon-navigator hidden=""> - <icon-button> + <icon-navigator hidden=""> + <icon-button> <a id="nav-middle-{{ path.Base .Identifier }}" href="{{ .URL | absURL }}"> - {{ with .Identifier }} - {{ $icon := print (partial "function-paths.html").static "/icons/" . ".svg" }} - {{ safeHTML (readFile $icon) }} - {{ end }} - <small>{{ delimit (first 1 (split .Name " ")) " " }}</small> + {{ with .Identifier }} + {{ $icon := print (partial "function-paths.html").static "/icons/" . ".svg" }} + {{ safeHTML (readFile $icon) }} + {{ end }} + <small>{{ delimit (first 1 (split .Name " ")) " " }}</small> </a> - </icon-button> - </icon-navigator> + </icon-button> + </icon-navigator> {{ end }} {{ end }} </nav> - <navigation-separator><hr hidden=""></hr></navigation-separator> - <xsl:for-each select="/rss/channel/item"> - <micro-card> - <micro-summary> - <micro-thumbnail> - <figure> - <a> - <xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute> - <picture> - <img> - <xsl:attribute name="alt"><xsl:value-of select="atom:author/atom:name"/></xsl:attribute> - <xsl:attribute name="title"><xsl:value-of select="atom:author/atom:name"/></xsl:attribute> - <xsl:attribute name="src"><xsl:value-of select="atom:author/atom:uri"/></xsl:attribute> - </img> - </picture> - </a> - </figure> - </micro-thumbnail> - <article> - <h2> - <a> - <xsl:attribute name="href"><xsl:value-of select="link" /></xsl:attribute> - <xsl:value-of select="title" /> - </a> - </h2> - <small>Published: <xsl:value-of select="pubDate"/></small> - </article> - </micro-summary> - </micro-card> - </xsl:for-each> + <main> + <xsl:for-each select="/rss/channel/item"> + <micro-card> + <header> + <figure> + <a> + <xsl:attribute name="href"><xsl:value-of select="link" /></xsl:attribute> + <span> + <object> + <xsl:attribute name="title"><xsl:value-of select="atom:author/atom:name" /></xsl:attribute> + <xsl:attribute name="data"><xsl:value-of select="atom:author/atom:uri" /></xsl:attribute> + <xsl:value-of select="substring(atom:author/atom:name, 1, 1)" /> + </object> + </span> + </a> + </figure> + </header> + <article> + <h2> + <a> + <xsl:attribute name="href"><xsl:value-of select="link" /></xsl:attribute> + <xsl:value-of select="title" /> + </a> + </h2> + <small>Published: <xsl:value-of select="pubDate" /></small> + </article> + </micro-card> + </xsl:for-each> </main> - </column-middle> - <column-right> - </column-right> + </column-base> + <column-base position="right"></column-base> </body> </html> </xsl:template> diff --git a/themes/default/layouts/_default/home.xslt.sitemap.xsl b/themes/default/layouts/_default/home.xslt.sitemap.xsl index ce3fe98..e0be723 100644 --- a/themes/default/layouts/_default/home.xslt.sitemap.xsl +++ b/themes/default/layouts/_default/home.xslt.sitemap.xsl @@ -6,48 +6,48 @@ > <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> - <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" xml-data="sitemap"> + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" data-xml="sitemap" data-document="xhtml"> <head> <title>{{ $.Site.Title }} Site Map</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> - {{- partial "base-css.html" . -}} + {{- partial "head-css.html" . -}} + {{- partial "head-js.html" . -}} </head> <body> - <column-left> - </column-left> - <column-middle> - <main> - <nav> - <icon-button> - <a onclick="window.history.go(-1); return false;" href="/"> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }} - <small>Back</small> - </a> - </icon-button> - <section> - <h2>{{ $.Site.Title }} Site Map</h2> - <small>Site Map Preview</small> - </section> - {{ if .Site.Menus.main }} - {{ range .Site.Menus.main }} - <icon-navigator hidden=""> - <icon-button> - <a - id="nav-middle-{{ path.Base .Identifier }}" - href="{{ .URL | absURL }}" - > - {{ with .Identifier }} - {{ $icon := print (partial "function-paths.html").static "/icons/" . ".svg" }} - {{ safeHTML (readFile $icon) }} - {{ end }} - <small>{{ delimit (first 1 (split .Name " ")) " " }}</small> - </a> - </icon-button> - </icon-navigator> - {{ end }} + <column-base position="left"></column-base> + <column-base position="middle"> + <nav> + <icon-button> + <a id="back" target="_self" href="/"> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }} + <small>Back</small> + </a> + </icon-button> + <section> + <h2>{{ $.Site.Title }} Site Map</h2> + <small>Site Map Preview</small> + </section> + {{ if .Site.Menus.main }} + {{ range .Site.Menus.main }} + <icon-navigator hidden=""> + <icon-button> + <a + id="nav-middle-{{ path.Base .Identifier }}" + href="{{ .URL | absURL }}" + > + {{ with .Identifier }} + {{ $icon := print (partial "function-paths.html").static "/icons/" . ".svg" }} + {{ safeHTML (readFile $icon) }} + {{ end }} + <small>{{ delimit (first 1 (split .Name " ")) " " }}</small> + </a> + </icon-button> + </icon-navigator> {{ end }} - </nav> + {{ end }} + </nav> + <main> <navigation-separator><hr hidden=""></hr></navigation-separator> <section> <table> @@ -69,10 +69,9 @@ <xsl:attribute name="href"> <xsl:value-of select="sitemap:loc" /> </xsl:attribute> - <xsl:attribute name="title"> - Last Modified: <xsl:value-of select="sitemap:lastmod" /> - Frequency: <xsl:value-of select="sitemap:changefreq" /> - Priority: <xsl:value-of select="sitemap:priority" /> +<xsl:attribute name="title">Last Modified: <xsl:value-of select="sitemap:lastmod" /> +Frequency: <xsl:value-of select="sitemap:changefreq" /> +Priority: <xsl:value-of select="sitemap:priority" /> </xsl:attribute> <xsl:value-of select="sitemap:loc" /> </a> @@ -83,9 +82,8 @@ </table> </section> </main> - </column-middle> - <column-right> - </column-right> + </column-base> + <column-base position="right"></column-base> </body> </html> </xsl:template> diff --git a/themes/default/layouts/_default/index.html b/themes/default/layouts/_default/index.html index 37c9855..f25cabf 100644 --- a/themes/default/layouts/_default/index.html +++ b/themes/default/layouts/_default/index.html @@ -1,51 +1,34 @@ -{{ define "styles" }} +{{- define "styles" -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} </style> -{{ end }} - -{{ define "middle" }} - - {{- if gt .Paginator.PageNumber 1 -}} - {{- partial "navigator-middle.html" - (dict - "Context" . - "Href" "/" - "Icon" "arrow-left" - "IconLabel" "Back" - "Id" "back" - "Title" "Home" - "Subtitle" (partial "count-total-messages.html" .) - ) - -}} - {{- else -}} - {{- partial "navigator-middle.html" - (dict - "Context" . - "Subtitle" (partial "count-total-messages.html" .) - "Title" "Home" - ) - -}} +{{- end -}} + +{{- define "header" -}} + {{- partial "navigator-middle.html" + (dict + "Context" . + "Title" "Home" + "Subtitle" (print (partial "count.html" .) " " "Total") + "IconLabel" (and (gt .Paginator.PageNumber 1) "Back") + "Id" (and (gt .Paginator.PageNumber 1) "back") + "Icon" (and (gt .Paginator.PageNumber 1) "arrow-left") + "Href" (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) + ) + -}} +{{- end -}} + +{{- define "middle" -}} + {{- range .Paginator.Pages -}} + {{- partial "render-embed.html" . -}} {{- end -}} +{{- end -}} - {{ range .Paginator.Pages }} - {{ .Render "summary" }} - {{ end }} - - {{ partial "pagination.html" . }} - -{{ end }} - -{{ define "right" }} - {{- partial "author-list.html" . -}} - - {{ range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.gallery) }} - {{- partial "gallery.html" . -}} - {{ end }} - - {{ range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.webring) }} - {{- partial "following-list.html" . -}} - {{- partial "webring.html" . -}} - {{ end }} +{{- define "footer" -}} + {{- partial "pagination.html" . -}} + {{- partial "footer.html" . -}} +{{- end -}} -{{ end }} +{{- define "right" -}} + {{- partial "navigator-right.html" . -}} +{{- end -}} diff --git a/themes/default/layouts/_default/index.json b/themes/default/layouts/_default/index.json index b9d9068..9484e60 100644 --- a/themes/default/layouts/_default/index.json +++ b/themes/default/layouts/_default/index.json @@ -15,8 +15,8 @@ { "id": "{{ sha256 $data.Permalink }}", "url": "{{ $data.Permalink }}", - "title": "{{ $data.Summary | htmlUnescape }}", - "summary": "{{ $data.Summary | htmlUnescape }}", + "title": {{ $data.Summary | htmlUnescape | jsonify }}, + "summary": {{ $data.Summary | htmlUnescape | jsonify }}, "date_modified": "{{ $data.Date | time.Format "2006-01-02T15:04:05Z" }}", "date_published": "{{ $data.PublishDate | time.Format "2006-01-02T15:04:05Z" }}", "_metadata": { diff --git a/themes/default/layouts/_default/index.webmanifest b/themes/default/layouts/_default/index.webmanifest deleted file mode 100644 index f7b3f66..0000000 --- a/themes/default/layouts/_default/index.webmanifest +++ /dev/null @@ -1,24 +0,0 @@ -{{- $icon := resources.Get .Site.Params.webmanifest.logo -}} - -{{- $androidChrome192 := $icon.Fit "192x192" -}} -{{- $androidChrome512 := $icon.Fit "512x512" -}} - -{ - "name": "{{ .Site.Params.webmanifest.name }}", - "short_name": "{{ .Site.Params.webmanifest.shortName }}", - "icons": [ - { - "src": "{{ $androidChrome192.Permalink }}", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "{{ $androidChrome512.Permalink }}", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "{{ .Site.Params.webmanifest.themeColor }}", - "background_color": "{{ .Site.Params.webmanifest.backgroundColor }}", - "display": "{{ .Site.Params.webmanifest.display }}" -} diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml index 3e8e337..16aee5f 100644 --- a/themes/default/layouts/_default/rss.xml +++ b/themes/default/layouts/_default/rss.xml @@ -1,24 +1,28 @@ {{- define "main" -}} +{{- $absURL := "" | absURL -}} + {{- $limit := .Site.Config.Services.RSS.Limit -}} {{- if lt $limit 1 -}} {{- $limit = .Paginator.TotalNumberOfElements -}} {{- end -}} -{{- $lastBuildDate := now.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} +{{- $lastBuildDate := now | time.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} {{- if not .Date.IsZero -}} - {{- $lastBuildDate = .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} + {{- $lastBuildDate = .Date | time.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} {{- end -}} -{{- $title := partial "base-title.html" . -}} -{{- $description := partial "base-title.html" . -}} +{{- $title := partial "head-title.html" . -}} +{{- $description := partial "head-title.html" . -}} {{- $author := partial "function-authors-data.html" . -}} +{{- $image := print "/favicon.ico" -}} {{- if (eq .Page.Kind "section") -}} {{- $title = $author.name -}} {{- $description = $author.description | markdownify | html | htmlUnescape -}} + {{- $image = print "/" (partial "function-paths.html").media "/" .Section "/" .Section "-profile" (path.Ext $author.picture.profile) -}} {{- end -}} {{- if (eq .Page.Type "tags") -}} @@ -26,14 +30,6 @@ {{- $description = print .Site.Title " Tags: #" .Title -}} {{- end -}} -{{- $image := print "/" (partial "function-paths.html").media - "/" $author.user "/" $author.user "-profile" (path.Ext $author.picture.profile) --}} - -{{- if not (fileExists (print "public/" $image)) -}} - {{- $image = "/data/media/404.png" -}} -{{- end -}} - {{- $atomSelf := "" -}} {{- $atomPrevious := "" -}} {{- $atomNext := "" -}} @@ -42,11 +38,11 @@ {{- $atomSelf = printf `<atom:link rel="self" href=%q type=%q />` .Permalink .MediaType | safeHTML -}} {{- with $.Paginator.Prev -}} - {{- $atomPrevious = printf `<atom:link rel="previous" href=%q />` .URL | safeHTML -}} + {{- $atomPrevious = printf `<atom:link rel="previous" href=%q />` (.URL | absURL) | safeHTML -}} {{- end -}} {{- with $.Paginator.Next -}} - {{- $atomNext = printf `<atom:link rel="next" href=%q />` .URL | safeHTML -}} + {{- $atomNext = printf `<atom:link rel="next" href=%q />` (.URL | absURL) | safeHTML -}} {{- end -}} {{- end -}} @@ -60,16 +56,16 @@ xmlns:atom="http://www.w3.org/2005/Atom" > <channel> - <title>{{ $title }}</title> + <title>{{ or $title (title .Section) }}</title> <link>{{ .Permalink }}</link> <description>{{ $description }}</description> <language>{{ .Site.LanguageCode }}</language> - <category>{{ $author.user }}</category> + <category>{{ or $author.user "default" }}</category> <generator>Hugo {{ hugo.Version }}</generator> <lastBuildDate>{{ $lastBuildDate }}</lastBuildDate> <image> <title>{{ $title }}</title> - <url>{{ .Site.BaseURL }}{{ $image }}</url> + <url>{{ $absURL }}{{ $image }}</url> <link>{{ .Permalink }}</link> </image> @@ -85,30 +81,24 @@ "/" $author.user "/" $author.user "-profile" (path.Ext $author.picture.profile) -}} - {{- if not (fileExists (print "public/" $image)) -}} - {{- $image = "/data/media/404.png" -}} - {{- end -}} - - {{- $atomAuthorUri := print .Site.BaseURL $image -}} + {{- $atomAuthorUri := print $absURL $image -}} {{- $atomAuthorName := or .Params.Feed.name $author.name -}} {{- if .Params.Feed.favicon -}} {{- $favicon := print "/" (partial "function-paths.html").media "/favicon." (.Params.Feed.source | anchorize) ".png" -}} - {{- if not (fileExists (print "public/" $favicon)) -}} - {{- $favicon = "/data/media/404.png" -}} - {{- end -}} - {{- $atomAuthorUri = print .Site.BaseURL $favicon -}} + {{- $atomAuthorUri = print $absURL $favicon -}} {{- end -}} <item> <title>{{ (or .Summary .Title) | htmlUnescape }}</title> - <link>{{ .Permalink }}</link> - <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + <link>{{ or .Params.Feed.link .Permalink }}</link> + <pubDate>{{ .Date | time.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <guid>{{ .Permalink }}</guid> <description> - {{- partial "function-content.html" . | html -}} - {{- print "<br>" | html -}} - {{- partial "rss-tags.html" . | html -}} + {{ partial "function-content.html" . | html -}} + {{- print "<br /><br />" | html -}} + {{- printf `<a href=%q>Permalink</a> ` .Permalink | html }} + {{ partial "tags.html" (dict "Format" "rss" "Context" .) | html }} </description> <atom:author> <atom:name>{{ $atomAuthorName }}</atom:name> @@ -119,5 +109,4 @@ {{ end -}} </channel> </rss> - {{- end -}} diff --git a/themes/default/layouts/_default/section.drafts.html b/themes/default/layouts/_default/section.drafts.html index ad862c4..bb7485c 100644 --- a/themes/default/layouts/_default/section.drafts.html +++ b/themes/default/layouts/_default/section.drafts.html @@ -1,56 +1,58 @@ -{{ define "styles" }} +{{- define "styles" -}} {{- $author := partial "function-authors-data.html" . -}} {{- $author = $author.user -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} - tab-bar a[href="{{ .Site.BaseURL }}/{{ $author }}/drafts/"] { + tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/drafts"] { color: #111; color: var(--foreground); - display: inherit; font-weight: 700; text-decoration-color: #014cc6; text-decoration-color: var(--link); text-decoration: underline; + border-bottom: 2px solid var(--background); } </style> -{{ end }} +{{- end -}} -{{ define "middle" }} +{{- define "header" -}} + {{- $author := partial "function-authors-data.html" . -}} + {{- $authors := where .Site.RegularPages "Section" $author.user -}} + {{- $drafts := where .Site.RegularPages "Draft" true -}} + {{- $filteredPages := $authors | intersect $drafts -}} + {{- $paginator := .Paginate $filteredPages -}} - {{ partial "navigator-middle.html" + {{- partial "navigator-middle.html" (dict - "Title" "Drafts" - "Subtitle" (partial "count-drafts.html" .) - "Icon" "arrow-left" + "Context" . "IconLabel" "Back" - "Href" "/" "Id" "back" - "Context" . + "Title" "Drafts" + "Icon" "arrow-left" + "Subtitle" (print (partial "count-drafts.html" .) " " "Total") + "Href" (or (and (gt $paginator.PageNumber 1) ($paginator.Paginator.Prev.URL | absURL)) "/") ) - }} - - {{ partial "profile.html" . }} + -}} - {{- $author := partial "function-authors-data.html" . -}} - {{- $author = $author.user -}} - {{- $users := where .Site.RegularPages "Section" $author -}} - {{- $drafts := where .Site.RegularPages "Draft" true -}} - {{- $filteredPages := $users | intersect $drafts -}} - {{- $paginator := .Paginate $filteredPages }} + {{- partial "profile.html" . -}} +{{- end -}} - {{ range $paginator.Pages }} - {{ .Render "summary" }} - {{ else }} +{{- define "middle" -}} + {{- range .Paginator.Pages -}} + {{- partial "render-embed.html" . -}} + {{- else -}} <footer> - <code>No drafts found!</code> + <code>No items found!</code> </footer> - {{ end }} - - {{ partial "pagination.html" . }} + {{- end -}} +{{- end -}} -{{ end }} +{{- define "footer" -}} + {{- partial "pagination.html" . -}} + {{- partial "footer.html" . -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/section.feeds.html b/themes/default/layouts/_default/section.feeds.html index 20566df..e239928 100644 --- a/themes/default/layouts/_default/section.feeds.html +++ b/themes/default/layouts/_default/section.feeds.html @@ -1,51 +1,53 @@ -{{ define "styles" }} +{{- define "styles" -}} {{- $author := partial "function-authors-data.html" . -}} {{- $author = $author.user -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} - tab-bar a[href="{{ .Site.BaseURL }}/{{ $author }}/feeds/"] { + tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/feeds"] { color: #111; color: var(--foreground); - display: inherit; font-weight: 700; text-decoration-color: #014cc6; text-decoration-color: var(--link); text-decoration: underline; + border-bottom: 2px solid var(--background); } </style> -{{ end }} +{{- end -}} -{{ define "middle" }} - - {{ partial "navigator-middle.html" +{{- define "header" -}} + {{- partial "navigator-middle.html" (dict - "Title" "Feeds" - "Subtitle" (partial "count-feeds.html" .) - "Icon" "arrow-left" + "Context" . "IconLabel" "Back" - "Href" "/" "Id" "back" - "Context" . + "Title" "Feeds" + "Icon" "arrow-left" + "Subtitle" (print (partial "count-feeds.html" .) " " "Total") + "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/") ) - }} + -}} - {{ partial "profile.html" . }} + {{- partial "profile.html" . -}} +{{- end -}} - {{ range .Paginator.Pages }} - {{ .Render "summary" }} - {{ else }} +{{- define "middle" -}} + {{- range .Paginator.Pages -}} + {{- partial "render-embed.html" . -}} + {{- else -}} <footer> - <code>No feeds found!</code> + <code>No items found!</code> </footer> - {{ end }} - - {{ partial "pagination.html" . }} - - {{ $writeToFile := partial "function-generate-feeds" . }} + {{- end -}} + {{- $writeToFile := partial "function-generate-feeds" . -}} +{{- end -}} -{{ end }} +{{- define "footer" -}} + {{- partial "pagination.html" . -}} + {{- partial "footer.html" . -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/section.following.html b/themes/default/layouts/_default/section.following.html index 48afa7d..2bfcc2e 100644 --- a/themes/default/layouts/_default/section.following.html +++ b/themes/default/layouts/_default/section.following.html @@ -1,23 +1,32 @@ -{{- $sources := slice -}} -{{- $author := partial "function-authors-data.html" . -}} -{{- $feeds := partial "function-generate-feeds.html" . -}} +{{- $parent := eq (len .Page.Ancestors) 1 -}} -{{- range $author.feeds.rss -}} - {{- $data := split . " " -}} - {{- $url := delimit (first 1 $data) "" -}} - {{- $sources = $sources | append (string $url) -}} -{{- end -}} +{{- $modified := partial "function-page-modified.html" + (dict + "Context" . + "Disable" true + ) +-}} + +{{- if (and $parent $modified) -}} + {{- $sources := slice -}} + {{- $author := partial "function-authors-data.html" . -}} + {{- $feeds := partial "function-generate-feeds.html" . -}} + + {{- range $author.feeds.rss -}} + {{- $data := split . " " -}} + {{- $url := delimit (first 1 $data) "" -}} + {{- $sources = $sources | append (string $url) -}} + {{- end -}} -{{- range $source := (first 3 (shuffle $sources)) -}} - {{- range $distinct := first 1 (where $feeds "FeedSourceLink" "eq" $source) -}} + {{- range $source := $sources -}} + {{- range $distinct := first 1 (where $feeds "FeedSourceLink" "eq" $source) -}} - {{- $href := or $distinct.FeedHome (print "http://" $distinct.FeedSourceDomain) -}} - {{- $favicon := print "/" (partial "function-paths.html").media "/favicon." (.FeedSourceLink | anchorize) ".png" -}} + {{- $href := or $distinct.FeedHome (print "http://" $distinct.FeedSourceDomain) -}} + {{- $favicon := print "/" (partial "function-paths.html").media "/favicon." (.FeedSourceLink | anchorize) ".png" -}} - <micro-author> - <micro-card> - <micro-summary> - <micro-thumbnail> + <micro-author> + <micro-card> + <header> <figure> <a title="{{ $distinct.FeedName }}" @@ -32,8 +41,8 @@ </picture> </a> </figure> - </micro-thumbnail> - <micro-header> + </header> + <article> <h2> <b>{{ $distinct.FeedName }}</b> </h2> @@ -46,20 +55,21 @@ </a> </h3> <time + data-type="default" title="{{ $distinct.FeedDateTitle }}" datetime="{{ $distinct.FeedDateTime }}"> - {{ $distinct.FeedDateTime | time.Format "15:04 Jan 2 2006" -}} + {{ $distinct.FeedDate -}} </time> - </micro-header> + </article> <a title="Follow {{ $distinct.FeedName }}" href="{{ $href }}"> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/rss.svg")) }} - <span>Follow</span> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/rss.svg")) }} + <span>Feed</span> </a> - </micro-summary> - </micro-card> - </micro-author> + </micro-card> + </micro-author> + {{- end -}} {{- end -}} {{- end -}} diff --git a/themes/default/layouts/_default/section.gallery.html b/themes/default/layouts/_default/section.gallery.html index dfa141e..761a276 100644 --- a/themes/default/layouts/_default/section.gallery.html +++ b/themes/default/layouts/_default/section.gallery.html @@ -1 +1,12 @@ -{{- partial "gallery-walk.html" . -}} +{{- $parent := eq (len .Page.Ancestors) 1 -}} + +{{- $modified := partial "function-page-modified.html" + (dict + "Context" . + "Disable" true + ) +-}} + +{{- if (and $parent $modified) -}} + {{- partial "gallery-walk.html" . -}} +{{- end -}} diff --git a/themes/default/layouts/_default/section.html b/themes/default/layouts/_default/section.html index 9d32210..901ca1f 100644 --- a/themes/default/layouts/_default/section.html +++ b/themes/default/layouts/_default/section.html @@ -1,58 +1,56 @@ -{{ define "styles" }} +{{- define "styles" -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} tab-bar a[href="{{ .CurrentSection.Permalink }}"], + tab-bar a[href^="{{ .CurrentSection.Permalink }}#"], tab-bar a[href="{{ strings.TrimRight "/" .CurrentSection.Permalink }}"] { color: #111; color: var(--foreground); - display: inherit; font-weight: 700; text-decoration-color: #014cc6; text-decoration-color: var(--link); text-decoration: underline; + border-bottom: 2px solid var(--background); } </style> -{{ end }} - -{{ define "middle" }} - - {{- $messages := print - (lang.FormatNumberCustom 0 .Paginator.TotalNumberOfElements) - " " - "Messages" - -}} +{{- end -}} +{{- define "header" -}} {{- $author := partial "function-authors-data.html" . -}} - {{ partial "navigator-middle.html" + {{- partial "navigator-middle.html" (dict - "Title" $author.name - "Subtitle" $messages - "Icon" "arrow-left" + "Context" . "IconLabel" "Back" - "Href" "/" "Id" "back" - "Context" . + "Title" $author.name + "Icon" "arrow-left" + "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/") + "Subtitle" (print (lang.FormatNumberCustom 0 .Paginator.TotalNumberOfElements) " " "Total") ) - }} + -}} - {{ partial "author-section-picture.html" . }} + {{- partial "author-section-picture.html" . -}} - {{ partial "profile.html" . }} + {{- partial "profile.html" . -}} +{{- end -}} - {{ range .Paginator.Pages }} - {{ .Render "summary" }} - {{ else }} +{{- define "middle" -}} + {{- range .Paginator.Pages -}} + {{- partial "render-embed.html" . -}} + {{- else -}} <footer> - <code>No messages found!</code> + <code>No items found!</code> </footer> - {{ end }} - - {{ partial "pagination.html" . }} + {{- end -}} +{{- end -}} -{{ end }} +{{- define "footer" -}} + {{- partial "pagination.html" . -}} + {{- partial "footer.html" . -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/section.likes.html b/themes/default/layouts/_default/section.likes.html deleted file mode 100644 index 650c326..0000000 --- a/themes/default/layouts/_default/section.likes.html +++ /dev/null @@ -1,56 +0,0 @@ -{{ define "styles" }} -{{- $author := partial "function-authors-data.html" . -}} -{{- $author = $author.user -}} -<style> - {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} - - tab-bar a[href="{{ .Site.BaseURL }}/{{ $author }}/likes/"] { - color: #111; - color: var(--foreground); - display: inherit; - font-weight: 700; - text-decoration-color: #014cc6; - text-decoration-color: var(--link); - text-decoration: underline; - } -</style> -{{ end }} - -{{ define "middle" }} - - {{ partial "navigator-middle.html" - (dict - "Title" "Likes" - "Subtitle" (partial "count-likes.html" .) - "Icon" "arrow-left" - "IconLabel" "Back" - "Href" "/" - "Id" "back" - "Context" . - ) - }} - - {{ partial "profile.html" . }} - - {{- $author := partial "function-authors-data.html" . -}} - {{- $author = $author.user -}} - {{- $users := where .Site.RegularPages "Section" $author -}} - {{- $likes := where .Site.RegularPages ".Params.liked" true -}} - {{- $filteredPages := $users | intersect $likes -}} - {{- $paginator := .Paginate $filteredPages }} - - {{ range $paginator.Pages }} - {{ .Render "summary" }} - {{ else }} - <footer> - <code>No likes found!</code> - </footer> - {{ end }} - - {{ partial "pagination.html" . }} - -{{ end }} - -{{ define "right" }} - {{- partial "navigator-right.html" . -}} -{{ end }} diff --git a/themes/default/layouts/_default/section.marks.html b/themes/default/layouts/_default/section.marks.html new file mode 100644 index 0000000..def6c94 --- /dev/null +++ b/themes/default/layouts/_default/section.marks.html @@ -0,0 +1,58 @@ +{{- define "styles" -}} +{{- $author := partial "function-authors-data.html" . -}} +{{- $author = $author.user -}} +<style> + {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} + + tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/marks"] { + color: #111; + color: var(--foreground); + font-weight: 700; + text-decoration-color: #014cc6; + text-decoration-color: var(--link); + text-decoration: underline; + border-bottom: 2px solid var(--background); + } +</style> +{{- end -}} + +{{- define "header" -}} + {{- $author := partial "function-authors-data.html" . -}} + {{- $authors := where .Site.RegularPages "Section" $author.user -}} + {{- $items := where .Site.RegularPages ".Params.marked" true -}} + {{- $filteredPages := $authors | intersect $items -}} + {{- $paginator := .Paginate $filteredPages -}} + + {{- partial "navigator-middle.html" + (dict + "Context" . + "IconLabel" "Back" + "Id" "back" + "Title" "Marks" + "Icon" "arrow-left" + "Subtitle" (print (partial "count-marks.html" .) " " "Total") + "Href" (or (and (gt $paginator.PageNumber 1) ($paginator.Prev.URL | absURL)) "/") + ) + -}} + + {{- partial "profile.html" . -}} +{{- end -}} + +{{- define "middle" -}} + {{- range .Paginator.Pages -}} + {{- partial "render-embed.html" . -}} + {{- else -}} + <footer> + <code>No items found!</code> + </footer> + {{- end -}} +{{- end -}} + +{{- define "footer" -}} + {{- partial "pagination.html" . -}} + {{- partial "footer.html" . -}} +{{- end -}} + +{{- define "right" -}} + {{- partial "navigator-right.html" . -}} +{{- end -}} diff --git a/themes/default/layouts/_default/section.media.html b/themes/default/layouts/_default/section.media.html index 9191a3e..ce570c7 100644 --- a/themes/default/layouts/_default/section.media.html +++ b/themes/default/layouts/_default/section.media.html @@ -1,70 +1,65 @@ -{{ define "styles" }} +{{- define "styles" -}} {{- $author := partial "function-authors-data.html" . -}} {{- $author = $author.user -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} - tab-bar a[href="{{ .Site.BaseURL }}/{{ $author }}/media/"] { + tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/media"] { color: #111; color: var(--foreground); - display: inherit; font-weight: 700; text-decoration-color: #014cc6; text-decoration-color: var(--link); text-decoration: underline; + border-bottom: 2px solid var(--background); } </style> -{{ end }} +{{- end -}} -{{ define "middle" }} - - {{ partial "navigator-middle.html" +{{- define "header" -}} + {{- partial "navigator-middle.html" (dict "Title" "Media" - "Subtitle" (partial "count-media.html" .) + "Subtitle" (print (partial "count-media.html" .) " " "Total") "Icon" "arrow-left" "IconLabel" "Back" "Href" "/" "Id" "back" "Context" . ) - }} + -}} - {{ partial "profile.html" . }} + {{- partial "profile.html" . -}} +{{- end -}} +{{- define "middle" -}} {{- $author := partial "function-authors-data.html" . -}} - {{- $author = $author.user -}} - - {{ $count := 0 }} - {{ $result := false }} + {{- $notFeeds := where .Site.RegularPages "Params.feed" "eq" nil -}} + {{- $authors := where .Site.RegularPages "Section" $author.user -}} + {{- $filteredPages := $authors | intersect $notFeeds -}} + {{- $count := 0 -}} - {{ range .Site.RegularPages }} - {{ if or - (in .Content "<figure>") - (in .Content "<imgur-video>") - (in .Content "<youtube-video>") - (in .Content "<video-container>") - }} - {{ if eq .Type $author }} - {{ $result = true }} - {{ $count = add $count 1 }} - {{ if le $count 10 }} - {{ .Render "summary" }} - {{ end }} - {{ end }} - {{ end }} - {{ end }} + {{- range first 100 $filteredPages -}} + {{- if eq $count 10 -}} + {{- break -}} + {{- end -}} + {{- if or + (in .Content "</video>") + (in .Content "</picture>") + (in .Content "</youtube-video>") + -}} + {{- partial "render-embed.html" . -}} + {{- $count = add $count 1 -}} + {{- end -}} + {{- end -}} - {{ if not $result }} + {{- if not $count -}} <footer> - <code>No media found!</code> + <code>No items found!</code> </footer> - {{ end }} - - {{ partial "pagination.html" . }} - -{{ end }} + {{- end -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/section.webring.html b/themes/default/layouts/_default/section.webring.html index 59b26ba..58181e1 100644 --- a/themes/default/layouts/_default/section.webring.html +++ b/themes/default/layouts/_default/section.webring.html @@ -1,57 +1,66 @@ -{{- $items := slice -}} -{{- $sources := slice -}} -{{- $author := partial "function-authors-data.html" . -}} -{{- $feeds := partial "function-generate-feeds.html" . -}} +{{- $parent := eq (len .Page.Ancestors) 1 -}} -{{- range $author.feeds.rss -}} - {{- $data := split . " " -}} - {{- $url := delimit (first 1 $data) "" -}} - {{- $sources = $sources | append (string $url) -}} -{{- end -}} - -{{- $inner := 1 -}} +{{- $modified := partial "function-page-modified.html" + (dict + "Context" . + "Disable" true + ) +-}} -{{- if eq (len $sources) 1 -}} - {{- $inner = 3 -}} -{{- end -}} +{{- if (and $parent $modified) -}} + {{- $items := slice -}} + {{- $sources := slice -}} + {{- $author := partial "function-authors-data.html" . -}} + {{- $feeds := partial "function-generate-feeds.html" . -}} -{{- range $source := (first 3 $sources) -}} - {{- range $distinct := first $inner (where $feeds "FeedSourceLink" "eq" $source) -}} - {{- $items = $items | append $distinct -}} + {{- range $author.feeds.rss -}} + {{- $data := split . " " -}} + {{- $url := delimit (first 1 $data) "" -}} + {{- $sources = $sources | append (string $url) -}} {{- end -}} -{{- end -}} -{{- range (sort $items "FeedDateTime" "desc") -}} + {{- $inner := 1 -}} - <web-ring-item> - <header> - <a - data-hover - title="{{ .FeedLink }}" - href="{{ .FeedLink }}"> - {{ or .FeedTitle (truncate 50 "..." (or .FeedContentShort .FeedDescriptionShort)) }} - </a> - </header> - <time - title="{{ .FeedDateTitle }}" - datetime="{{ .FeedDateTime }}"> - {{ .FeedDate }} - </time> - <p> - {{ "--" | markdownify }} - {{ if gt (len .FeedDescriptionShort) (len .FeedContentShort) -}} - {{ or .FeedDescriptionShort .FeedTitle }} - {{- else -}} - {{ or .FeedContentShort .FeedTitle }} - {{- end }} - — - </p> - <a - data-hover - title="{{ .FeedSourceDescription }}" - href="{{ or .FeedSourceHome .FeedSourceLink }}"> - {{ .FeedSourceTitle }} - </a> - </web-ring-item> + {{- if eq (len $sources) 1 -}} + {{- $inner = 3 -}} + {{- end -}} + + {{- range $source := (first 3 $sources) -}} + {{- range $distinct := first $inner (where $feeds "FeedSourceLink" "eq" $source) -}} + {{- $items = $items | append $distinct -}} + {{- end -}} + {{- end -}} + {{- range (sort $items "FeedDateTime" "desc") -}} + <article> + <h2> + <a + data-hover + title="{{ .FeedLink }}" + href="{{ .FeedLink }}"> + {{ or .FeedTitle (truncate 50 "..." (or .FeedContentShort .FeedDescriptionShort)) }} + </a> + </h2> + <p> + {{ if gt (len .FeedDescriptionShort) (len .FeedContentShort) -}} + {{ or .FeedDescriptionShort .FeedTitle }} + {{- else -}} + {{ or .FeedContentShort .FeedTitle }} + {{- end }} + <br /> + <a + data-hover + title="{{ .FeedSourceDescription }}" + href="{{ or .FeedSourceHome .FeedSourceLink }}"> + {{ .FeedSourceTitle }} + </a> + </p> + <time + data-type="default" + title="{{ .FeedDateTitle }}" + datetime="{{ .FeedDateTime }}"> + {{ .FeedDate }} + </time> + </article> + {{- end -}} {{- end -}} diff --git a/themes/default/layouts/_default/single.embed.html b/themes/default/layouts/_default/single.embed.html new file mode 100644 index 0000000..73a3add --- /dev/null +++ b/themes/default/layouts/_default/single.embed.html @@ -0,0 +1,26 @@ +{{- $pageContext := . -}} +{{- $format := "embed.html" -}} + +{{- $page := print "public/" (strings.TrimPrefix + $pageContext.Page.Site.BaseURL + $pageContext.Page.Permalink + ) $format +-}} + +{{- $modified := partial "function-page-modified.html" + (dict + "Context" $pageContext + "Format" $format + ) +-}} + +{{- with $embed := resources.Get $page -}} + {{- if (in $embed.Content "/data/media/404.png") -}} + {{- $modified = true -}} + {{- end -}} +{{- end -}} + +{{- if $modified -}} + {{- partial "head-embed.html" . -}} + {{- .Render "summary" -}} +{{- end -}} diff --git a/themes/default/layouts/_default/single.html b/themes/default/layouts/_default/single.html index 9aeb728..f3123b3 100644 --- a/themes/default/layouts/_default/single.html +++ b/themes/default/layouts/_default/single.html @@ -1,83 +1,79 @@ {{- define "styles" -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} </style> {{- end -}} -{{- define "middle" -}} - -{{- partial "navigator-middle.html" - (dict - "Title" "Message" - "Subtitle" "Thread" - "Icon" "arrow-left" - "IconLabel" "Back" - "Href" "/" - "Id" "back" - "Context" . - ) --}} +{{- define "header" -}} + {{- partial "navigator-middle.html" + (dict + "Title" "Post" + "Subtitle" "Thread" + "Icon" "arrow-left" + "IconLabel" "Back" + "Href" "/" + "Id" "back" + "Context" . + ) + -}} +{{- end -}} -<micro-thread> - {{ .Render "summary" }} +{{- define "middle" -}} + <micro-thread> + {{- partial "render-embed.html" . -}} - {{- $nextHref := "" -}} - {{- $prevHref := "" -}} - {{- $nextTitle := "" -}} - {{- $prevTitle := "" -}} - {{- $nextInvisible := "data-invisible" -}} - {{- $prevInvisible := "data-invisible" -}} + {{- $prevHref := "/" -}} + {{- $nextHref := "/" -}} + {{- $prevTitle := "hidden" -}} + {{- $nextTitle := "hidden" -}} - {{- with .Next -}} - {{- $nextHref = $.Next.Permalink -}} - {{- $nextTitle = $.Next.Summary -}} - {{- $nextInvisible = "" -}} - {{- end -}} + {{- with .Next -}} + {{- $nextHref = $.Next.Permalink -}} + {{- $nextTitle = $.Next.Summary -}} + {{- end -}} - {{- with .Prev -}} - {{- $prevHref = $.Prev.Permalink -}} - {{- $prevTitle = $.Prev.Summary -}} - {{- $prevInvisible = "" -}} - {{- end -}} + {{- with .Prev -}} + {{- $prevHref = $.Prev.Permalink -}} + {{- $prevTitle = $.Prev.Summary -}} + {{- end -}} - {{- with or .Next .Prev -}} - <paginator-navigation> - <a {{ $nextInvisible | safeHTMLAttr }} href="{{ $nextHref }}" title="{{ $nextTitle }}"> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }} - Newer - </a> + {{- with or .Next .Prev -}} + <nav data-type="pagination"> + <a rel="next" href="{{ $nextHref }}" title="{{ $nextTitle }}"> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }} + <header>Newer</header> + </a> - <a {{ $prevInvisible | safeHTMLAttr }} href="{{ $prevHref }}" title="{{ $prevTitle }}"> - Older - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }} - </a> - </paginator-navigation> - {{- end -}} + <a rel="prev" href="{{ $prevHref }}" title="{{ $prevTitle }}"> + <header>Older</header> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }} + </a> + </nav> + {{- end -}} - {{- $filteredPages := partial "function-filters-content.html" (.Site.RegularPages.Related .) -}} - {{- $related := $filteredPages | first 3 -}} + {{- $filteredPages := partial "function-filters-content.html" (.Site.RegularPages.Related .) -}} + {{- $related := $filteredPages | first 3 -}} - {{- with $related -}} - <related-content> - <footer> - <samp> - Related Tags - {{- with $.Params.tags -}} - {{- range $tag := first 1 $.Params.tags -}} - {{- $link := print ("tags/" | relURL) ($tag | urlize) "/" }} - {{ print "---" " " "[#" $tag "](" $link ")" | markdownify -}} + {{- with $related -}} + <related-content> + <footer> + <samp> + Related Tags + {{- with $.Params.tags -}} + {{- range $tag := first 1 $.Params.tags -}} + {{- $link := print ("tags/" | relURL) ($tag | urlize) "/" }} + {{ print "---" " " "[#" $tag "](" $link ")" | markdownify -}} + {{- end -}} {{- end -}} - {{- end -}} - </samp> - </footer> - </related-content> - - {{- range $related -}} - {{- .Render "summary" -}} - {{- end -}} - {{- end -}} + </samp> + </footer> + </related-content> -</micro-thread> + {{- range $related -}} + {{- partial "render-embed.html" . -}} + {{- end -}} + {{- end -}} + </micro-thread> {{- end -}} {{- define "right" -}} diff --git a/themes/default/layouts/_default/single.plain.txt b/themes/default/layouts/_default/single.plain.txt index 36a7616..f46e495 100644 --- a/themes/default/layouts/_default/single.plain.txt +++ b/themes/default/layouts/_default/single.plain.txt @@ -1,3 +1,3 @@ {{- define "main" -}} - {{- partial "function-content.html" . | plainify | markdownify | htmlUnescape -}} + {{- partial "function-content.html" . | plainify | htmlUnescape -}} {{- end -}} diff --git a/themes/default/layouts/_default/sitemap.xml b/themes/default/layouts/_default/sitemap.xml index c47d1db..f8ab315 100644 --- a/themes/default/layouts/_default/sitemap.xml +++ b/themes/default/layouts/_default/sitemap.xml @@ -3,7 +3,7 @@ {{- $changefreq := "weekly" -}} {{- $priority := 0.5 -}} -{{- $lastmod := now.Format "2006-01-02T15:04:05-07:00" }} +{{- $lastmod := now | time.Format "2006-01-02T15:04:05-07:00" }} <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" @@ -21,7 +21,7 @@ {{- end -}} {{- if not .Lastmod.IsZero -}} - {{- $lastmod = safeHTML (.Lastmod.Format "2006-01-02T15:04:05-07:00") -}} + {{- $lastmod = safeHTML (.Lastmod | time.Format "2006-01-02T15:04:05-07:00") -}} {{- end }} <url> diff --git a/themes/default/layouts/_default/summary.html b/themes/default/layouts/_default/summary.html index 5bc738d..e820b24 100644 --- a/themes/default/layouts/_default/summary.html +++ b/themes/default/layouts/_default/summary.html @@ -1,3 +1,4 @@ +{{- $href := or .Params.Feed.link .Permalink -}} {{- $content := partial "function-content.html" . | safeHTML -}} {{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}} @@ -7,16 +8,15 @@ {{ if .Draft }}draft{{ end }} {{ if .ExpiryDate }}data-expires{{ end }} > - <micro-summary title="{{- partial "meta-title.html" . -}}"> - <micro-metadata> - <micro-thumbnail> - {{ partial "profile-picture.html" . }} - </micro-thumbnail> - {{ partial "card-meta-header.html" . }} - </micro-metadata> - <article aria-label="article"> - {{- $content -}} - <micro-tags>{{ partial "meta-tags.html" . }}</micro-tags> - </article> - </micro-summary> + <a href="{{ $href }}"></a> + <header> + {{ partial "profile-picture.html" . }} + {{ partial "card-meta-header.html" . }} + </header> + <article aria-label="article"> + {{- $content -}} + <micro-tags> + {{- partial "tags.html" (dict "Format" "page" "Context" .) -}} + </micro-tags> + </article> </micro-card> diff --git a/themes/default/layouts/_default/taxonomy.html b/themes/default/layouts/_default/taxonomy.html index e0126d2..5c8e2ba 100644 --- a/themes/default/layouts/_default/taxonomy.html +++ b/themes/default/layouts/_default/taxonomy.html @@ -1,26 +1,27 @@ {{- define "styles" -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/tags/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/tags/") | safeCSS }} </style> {{- end -}} -{{- define "middle" -}} - +{{- define "header" -}} {{- partial "navigator-middle.html" (dict - "Title" "Tags" - "Subtitle" (partial "count-tags.html" .) - "Icon" "arrow-left" + "Context" . "IconLabel" "Back" - "Href" "/" "Id" "back" - "Context" . + "Title" "Tags" + "Icon" "arrow-left" + "Subtitle" (print (partial "count-tags.html" .) " " "Total") + "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/") ) -}} +{{- end -}} +{{- define "middle" -}} <tag-deck> {{- range .Paginator.Pages -}} - {{- $count := len .Data.Pages -}} + {{- $count := lang.FormatNumberCustom 0 (len .Data.Pages) -}} {{- $title := lower .Title -}} {{- range first 1 .Pages -}} @@ -42,16 +43,11 @@ </picture> </a> </figure> - <h3> - <a data-hover href="{{ print ("" | absURL) "/" $author.user "/" }}"> - @{{ $author.user }} - </a> - </h3> <time datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" title="{{ .Date | time.Format "Posted: Monday, January 2, 2006 at 15:04:05 MST" }}" > - {{ .Date.Format "02 Jan 2006" }} + {{ .Date | time.Format "02 Jan 2006" }} </time> <p> <a data-hover href="{{ print ("" | absURL) "/tags/" $title "/#" (partial "card-id.html" .) }}"> @@ -63,8 +59,11 @@ {{- end -}} {{- end -}} </tag-deck> +{{- end -}} - {{ partial "pagination.html" . }} +{{- define "footer" -}} + {{- partial "pagination.html" . -}} + {{- partial "footer.html" . -}} {{- end -}} {{- define "right" -}} diff --git a/themes/default/layouts/_default/term.html b/themes/default/layouts/_default/term.html index f8fc983..4f0d92a 100644 --- a/themes/default/layouts/_default/term.html +++ b/themes/default/layouts/_default/term.html @@ -1,33 +1,34 @@ -{{ define "styles" }} +{{- define "styles" -}} <style> - {{ partial "styles-navigator.html" (dict "Link" "/tags/") | safeCSS }} + {{ partial "navigator.css.html" (dict "Link" "/tags/") | safeCSS }} </style> -{{ end }} +{{- end -}} -{{ define "middle" }} - - {{- $terms := print (lang.FormatNumberCustom 0 (len .Data.Pages)) " " "Messages" -}} - - {{ partial "navigator-middle.html" +{{- define "header" -}} + {{- partial "navigator-middle.html" (dict - "Title" (print "#" .Title) - "Subtitle" $terms - "Icon" "arrow-left" + "Context" . "IconLabel" "Back" - "Href" "/" "Id" "back" - "Context" . + "Icon" "arrow-left" + "Title" (print "#" .Title) + "Subtitle" (print (lang.FormatNumberCustom 0 (len .Data.Pages)) " " "Total") + "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/") ) - }} - - {{ range .Paginator.Pages }} - {{ .Render "summary" }} - {{ end }} + -}} +{{- end -}} - {{ partial "pagination.html" . }} +{{- define "middle" -}} + {{- range .Paginator.Pages -}} + {{- partial "render-embed.html" . -}} + {{- end -}} +{{- end -}} -{{ end }} +{{- define "footer" -}} + {{- partial "pagination.html" . -}} + {{- partial "footer.html" . -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} |