diff options
Diffstat (limited to 'themes')
126 files changed, 1713 insertions, 1591 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 -}} diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index bbb3ec8..561fef3 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -1,5 +1,5 @@ {{- $metadata := print "public/" .Data.user "/author.json" -}} -{{- $date := .Date.Local.Format "15:04 Jan 2 2006" -}} +{{- $date := .Date | time.Format "Mon Jan 2 2006" -}} {{- $host := (urls.Parse ("" | absURL)).Host -}} @@ -17,9 +17,11 @@ {{- $sourceset = print "/" (partial "function-paths.html").media "/" .Data.user "/" .Data.user "-profile.webp" -}} {{- with $metadata := resources.Get $metadata -}} - {{- $metadata = $metadata.Content | transform.Unmarshal -}} - {{- $width = $metadata.picture.profileWidth -}} - {{- $height = $metadata.picture.profileHeight -}} + {{- with $content := $metadata.Content -}} + {{- $metadata = $content | transform.Unmarshal -}} + {{- $width = $metadata.picture.profileWidth -}} + {{- $height = $metadata.picture.profileHeight -}} + {{- end -}} {{- end -}} {{- if or @@ -36,45 +38,44 @@ <micro-author> <micro-card> - <micro-summary> - <micro-thumbnail> - <figure> - <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#"> - <picture> - {{- with $sourceset -}} - <source srcset="{{ $sourceset }}" type="image/webp" /> - {{- end -}} - <img - width="{{ or $width "64" }}" - height="{{ or $height "64" }}" - src="{{ $source }}" - alt="{{ $alternate }}" - /> - </picture> - </a> - </figure> - </micro-thumbnail> - <micro-header> - <h2> - <b>{{ .Data.name }}</b> - </h2> - <h3> - <a data-hover title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#"> - {{ .Data.user }}@{{ $host }} - </a> - </h3> - <time - title="{{ .Date.Format "Monday, January 2 2006 at 15:04:05 MST" }}" - datetime="{{ .Date.Format "2006-01-02T15:04:05Z" }}" - > - {{ $date }} - </time> - </micro-header> - <p>{{ .Data.description | markdownify | plainify | htmlUnescape | truncate 60 "..." }}</p> - <a title="Follow with RSS Reader" href="{{ "" | absURL }}/{{ .Data.user }}/rss.xml"> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/rss.svg")) }} - <span>Follow</span> - </a> - </micro-summary> + <header> + <figure> + <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/"> + <picture> + {{- with $sourceset -}} + <source srcset="{{ print ("" | absURL) $sourceset }}" type="image/webp" /> + {{- end -}} + <img + width="{{ or $width "64" }}" + height="{{ or $height "64" }}" + src="{{ print ("" | absURL) $source }}" + alt="{{ $alternate }}" + /> + </picture> + </a> + </figure> + </header> + <article> + <h2> + <b>{{ .Data.name }}</b> + </h2> + <h3> + <a data-hover="" title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/"> + {{ .Data.user }}@{{ $host }} + </a> + </h3> + <time + data-type="default" + title="{{ .Date | time.Format "Monday January 2 2006 at 15:04:05 MST" }}" + datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" + > + {{ $date }} + </time> + </article> + <p>{{ .Data.description | markdownify | plainify | htmlUnescape | truncate 60 "..." }}</p> + <a title="Follow with RSS Reader" href="{{ "" | absURL }}/{{ .Data.user }}/rss.xml"> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/rss.svg")) }} + <span>Feed</span> + </a> </micro-card> </micro-author> diff --git a/themes/default/layouts/partials/author-list.html b/themes/default/layouts/partials/author-list.html index 44b55aa..619b1b3 100644 --- a/themes/default/layouts/partials/author-list.html +++ b/themes/default/layouts/partials/author-list.html @@ -1,13 +1,17 @@ {{- $authors := print "public/authors.html" -}} <author-list> - <h1>Authors</h1> + <h1> + <a data-hover href="{{ "" | absURL }}/authors/"> + Authors + </a> + </h1> <aside> {{- with $authors = resources.Get $authors -}} {{- $authors.Content | safeHTML -}} {{- else -}} <footer> - <code>No authors found!</code> + <code>No items found!</code> </footer> {{- end -}} </aside> diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html index dbbfd69..01786e7 100644 --- a/themes/default/layouts/partials/author-picture.html +++ b/themes/default/layouts/partials/author-picture.html @@ -20,9 +20,11 @@ {{- $source = print "/" (partial "function-paths.html").media "/" $author.user "/" $author.user "-profile" (path.Ext $author.picture.profile) -}} {{- $sourceset = print "/" (partial "function-paths.html").media "/" $author.user "/" $author.user "-profile.webp" -}} {{- with $metadata := resources.Get $metadata -}} - {{- $metadata = $metadata.Content | transform.Unmarshal -}} - {{- $width = $metadata.picture.profileWidth -}} - {{- $height = $metadata.picture.profileHeight -}} + {{- with $content := $metadata.Content -}} + {{- $metadata = $content | transform.Unmarshal -}} + {{- $width = $metadata.picture.profileWidth -}} + {{- $height = $metadata.picture.profileHeight -}} + {{- end -}} {{- else -}} {{- $source = "/data/media/404.png" -}} {{- $sourceset = "" -}} @@ -35,13 +37,13 @@ {{- end -}} {{- with $sourceset -}} -<source srcset="{{ $sourceset }}" type="image/webp" /> +<source srcset="{{ print ("" | absURL) $sourceset }}" type="image/webp" /> {{- end -}} <img width="{{ $width }}" height="{{ $height }}" - src="{{ $source }}" + src="{{ print ("" | absURL) $source }}" alt="{{ $alternate }}" /> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/base-css.html b/themes/default/layouts/partials/base-css.html deleted file mode 100644 index 0a104c3..0000000 --- a/themes/default/layouts/partials/base-css.html +++ /dev/null @@ -1,16 +0,0 @@ -{{- $default := resources.Get "css/default.css" -}} -{{- $syntax := resources.Get "css/syntax-highlight-default.css" -}} - -{{- $css := - slice $default $syntax | - resources.Concat "css/bundle.css" | - resources.Minify | - fingerprint | --}} - -{{ if .Site.Params.site.production }} -<link title ="Default" rel="stylesheet" href="{{ $css.Permalink }}" /> -{{ else }} -<link title="Default" rel="stylesheet" href="{{ $default.Permalink }}" /> -<link rel="stylesheet" href="{{ $syntax.Permalink }}" /> -{{ end }} diff --git a/themes/default/layouts/partials/base-discovery.html b/themes/default/layouts/partials/base-discovery.html deleted file mode 100644 index 23d3a09..0000000 --- a/themes/default/layouts/partials/base-discovery.html +++ /dev/null @@ -1,49 +0,0 @@ -{{- - $authorData := (dict - "Context" . - "AuthorDefaultUser" .Site.Author.default.home - ) --}} - -{{- $author := partial "function-authors-data.html" (dict "Data" $authorData) -}} - -<link - rel="alternate" - type="application/rss+xml" - title="{{ $author.name }}'s Feed" - href="{{ .Site.BaseURL }}/{{ $author.user }}/rss.xml" -/> - -{{- with $author.feeds.rss }} - {{ range $author.feeds.rss }} - {{ $data := split . " " }} - {{- $url := delimit (first 1 $data) "" -}} - {{- $retitle := trim (delimit (after 1 $data) " ") " " -}} - {{- $retitle := and $retitle (print $retitle "'s Feed") -}} - - <link - rel="alternate" - type="application/rss+xml" - title="{{ or $retitle $url }}" - href="{{ $url }}" - /> - {{ end }} -{{ end }} - -{{- if (eq .Page.Kind "taxonomy") -}} -<link - rel="alternate" - type="application/rss+xml" - title="{{ .Title }} Feed" - href="{{ .Permalink }}rss.xml" -/> -{{- end -}} - -{{- if (eq .Page.Kind "term") -}} -<link - rel="alternate" - type="application/rss+xml" - title="#{{ lower .Title }} Tag Feed" - href="{{ .Permalink }}rss.xml" -/> -{{- end }} diff --git a/themes/default/layouts/partials/base-footer.html b/themes/default/layouts/partials/base-footer.html deleted file mode 100644 index f24b8d6..0000000 --- a/themes/default/layouts/partials/base-footer.html +++ /dev/null @@ -1,13 +0,0 @@ -{{ $author := index .Site.Data ((or .Params.author .Site.Author.default.footer) | default "default") }} - -<footer> - {{- with .Site.Author.footer -}} - {{ if $.IsHome -}} - {{ . | markdownify }} - {{- else -}} - {{ $author.title }} - {{- end -}} - {{- end }} - · Copyright © {{ now.Format "2006"}} - · <a href="/sitemap.xml" >Site Map</a> -</footer> diff --git a/themes/default/layouts/partials/base-head.html b/themes/default/layouts/partials/base-head.html deleted file mode 100644 index 2757f29..0000000 --- a/themes/default/layouts/partials/base-head.html +++ /dev/null @@ -1,74 +0,0 @@ -{{- - $authorData := (dict - "Context" . - "AuthorDefaultUser" .Site.Author.default.home - ) --}} - -{{- $author := partial "function-authors-data.html" (dict "Data" $authorData) -}} - -<!-- HTML Meta Tags --> -<meta charset="utf-8" /> -<meta name="author" content="{{ $author.name -}}" /> -{{ if or .Params.Feed .Params.Unlisted .Params.ExpiryDate -}} -<meta name="robots" content="noindex,nofollow" /> -{{- else -}} -<meta name="robots" content="{{ or .Site.Params.site.robots "index,follow" }}" /> -{{- end }} -<meta name="viewport" content="width=device-width, initial-scale=1" /> -<meta name="keywords" content="{{- partial "base-title.html" . -}}" /> -<meta name="generator" content="Hugo {{ hugo.Version }}" /> -{{ with .Site.Params.site.refresh -}} -<meta http-equiv="refresh" content="{{ . }}" /> -{{- end }} - -<!-- Search Engine Tags --> -<meta itemprop="name" content="{{ partial "base-title.html" . -}}" /> -<meta itemprop="description" content="{{ if .Params.summary }}{{ .Params.summary }}{{ else }}{{ .Summary }}{{ end }}" /> -<meta itemprop="image" content="{{ .Site.BaseURL }}/{{ $author.user -}}/media/profile/picture.png" /> - -<!-- Open Graph Meta Tags --> -<meta property="og:title" content="{{ partial "base-title.html" . -}}" /> -<meta property="og:description" content="{{- partial "base-description.html" . -}}" /> -<meta property="og:url" content="{{ .Permalink }}" /> -<meta property="og:image" content="{{ .Site.BaseURL }}/{{ $author.user -}}/media/profile/picture.png" /> -<meta property="og:type" content="website" /> -<meta property="article:published_time" content="{{ .Params.PublishDate }}" /> -<meta property="article:modified_time " content="{{ .Params.LastMod }}" /> - -<!-- Twitter Meta Tags --> -<meta name="twitter:card" content="summary_large_image" /> -<meta name="twitter:title" content="{{ partial "base-title.html" . -}}" /> -<meta name="twitter:description" content="{{- partial "base-description.html" . -}}" /> -<meta name="twitter:image" content="{{ .Site.BaseURL }}/{{ $author.user -}}/media/profile/picture.png" /> - -<!-- Search Verification --> -{{- partial "base-search.html" . -}} - -<!-- Link Tags --> -<link rel="home" href="{{ .Site.BaseURL }}/{{ $author.user }}/" /> - -<!-- Feed Discovery --> -{{- partial "base-discovery.html" . -}} - -<!-- Canonicalization --> -{{- partial "base-canonical.html" . -}} - -<!-- Styles --> -{{- partial "base-css.html" . -}} - -<!-- Scripts --> -{{- partial "base-js.html" . -}} - -<!-- Progressive Enhancement --> -{{- partial "base-manifest.html" . -}} - -<!-- Content Security Policy --> -{{- partial "base-csp.html" . -}} - -<!-- No Scripts --> -<noscript> - <style> - {{ safeCSS (readFile "assets/css/noscript.css") }} - </style> -</noscript> diff --git a/themes/default/layouts/partials/base-manifest.html b/themes/default/layouts/partials/base-manifest.html deleted file mode 100644 index 66e2354..0000000 --- a/themes/default/layouts/partials/base-manifest.html +++ /dev/null @@ -1,15 +0,0 @@ -{{- $icon := resources.Get .Site.Params.webmanifest.logo -}} - -{{- $icon32 := $icon.Fit "32x32" -}} -{{- $icon16 := $icon.Fit "16x16" -}} -{{- $appleTouchIcon := $icon.Fit "180x180" -}} - -{{- $ico := $icon32.Content | resources.FromString "/favicon.ico" -}} - -<link rel="icon" type="image/x-icon" href="data:image/ico;base64,{{ $icon32.Content | base64Encode }}" /> -<link rel="icon" type="image/png" sizes="16x16" href="data:image/png;base64,{{ $icon16.Content | base64Encode }}" /> -<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,{{ $icon32.Content | base64Encode }}" /> -<link rel="apple-touch-icon" sizes="180x180" href="data:image/png;base64,{{ $appleTouchIcon.Content | base64Encode }}" /> -<link rel="manifest" href="{{ .Site.BaseURL }}/site.webmanifest" /> -<meta name="msapplication-TileColor" content="#da532c" /> -<meta name="theme-color" content="#ffffff" /> diff --git a/themes/default/layouts/partials/base-search.html b/themes/default/layouts/partials/base-search.html deleted file mode 100644 index 1bfed6c..0000000 --- a/themes/default/layouts/partials/base-search.html +++ /dev/null @@ -1,11 +0,0 @@ -{{- with .Site.Params.search.verification.google -}} -<meta name="google-site-verification" content="{{ . }}" /> -{{ end }} - -{{- with .Site.Params.search.verification.bing -}} -<meta name="msvalidate.01" content="{{ . }}" /> -{{ end }} - -{{- with .Site.Params.search.verification.yandex -}} -<meta name="yandex-verification" content="{{ . }}" /> -{{ end }} diff --git a/themes/default/layouts/partials/card-meta-header.html b/themes/default/layouts/partials/card-meta-header.html index fd516f5..72b67b8 100644 --- a/themes/default/layouts/partials/card-meta-header.html +++ b/themes/default/layouts/partials/card-meta-header.html @@ -1,4 +1,4 @@ -<header> +<meta-data> {{- partial "meta-anchored.html" . -}} @@ -10,16 +10,16 @@ {{- partial "meta-handle.html" . -}} - {{- partial "meta-date-time.html" . -}} + {{- partial "meta-datetime.html" . -}} {{- partial "meta-view.html" . -}} - {{- partial "meta-context-menu.html" . -}} + {{- partial "meta-menu.html" . -}} - {{- partial "meta-read-time.html" . -}} + {{- partial "meta-wordcount.html" . -}} - {{- partial "meta-word-count.html" . -}} + {{- partial "meta-readtime.html" . -}} - {{- partial "meta-expiry-date.html" . -}} + {{- partial "meta-expirydate.html" . -}} -</header> +</meta-data> diff --git a/themes/default/layouts/partials/context-profile.html b/themes/default/layouts/partials/context-profile.html index 5b82cc9..5150128 100644 --- a/themes/default/layouts/partials/context-profile.html +++ b/themes/default/layouts/partials/context-profile.html @@ -1,18 +1,15 @@ -{{- $author := partial "function-authors-data.html" . -}} +{{- $author := partial "function-authors-data.html" . -}} {{- $description := or .Params.feed.description ($author.description | markdownify) -}} -{{- $name := or .Params.feed.name $author.name -}} -{{- $user := $author.user -}} - -{{- $host := or (urls.Parse .Site.BaseURL).Host "localhost" -}} -{{- $href := print .Site.BaseURL "/" $author.user "/#" -}} - -{{- $title := print $author.user "@" $host -}} +{{- $name := or .Params.feed.name $author.name -}} +{{- $host := or (urls.Parse .Site.BaseURL).Host "localhost" -}} +{{- $author := .Section -}} +{{- $href := print ("" | absURL) "/" $author "/" -}} +{{- $title := print $author "@" $host -}} {{- with .Params.feed -}} {{- $host = $.Params.feed.domain -}} {{- $href = or $.Params.feed.home (print "http://" $.Params.feed.domain) -}} {{- $title = $.Params.feed.domain -}} - {{- $user = "" -}} {{- end -}} <context-profile> @@ -29,7 +26,7 @@ </aside> <aside> <h2>{{ $name }}</h2> - <p>{{ $user }}@{{ $host }}</p> + <p>@{{ $host }}</p> </aside> </div> <p>{{ $description }}</p> diff --git a/themes/default/layouts/partials/count-authors.html b/themes/default/layouts/partials/count-authors.html index 2b46b52..8f2d7ef 100644 --- a/themes/default/layouts/partials/count-authors.html +++ b/themes/default/layouts/partials/count-authors.html @@ -1,2 +1,2 @@ {{- $authors := partial "function-authors-slice.html" . -}} -{{- print (lang.FormatNumberCustom 0 (len $authors)) " " "Authors" -}} +{{- print (lang.FormatNumberCustom 0 (len $authors)) -}} diff --git a/themes/default/layouts/partials/count-drafts.html b/themes/default/layouts/partials/count-drafts.html index 3c0cc5a..fae0b90 100644 --- a/themes/default/layouts/partials/count-drafts.html +++ b/themes/default/layouts/partials/count-drafts.html @@ -1,12 +1,7 @@ -{{- $author := partial "function-authors-data.html" . -}} -{{- $author = $author.user -}} +{{- $author := .Section -}} -{{ $count := 0 }} +{{- $authors := where .Site.RegularPages "Section" $author -}} +{{- $drafts := where .Site.RegularPages "Draft" true -}} +{{- $filteredPages := $authors | intersect $drafts -}} -{{ range .Site.Pages }} - {{ if and (eq .Type $author) .Draft }} - {{ $count = add $count 1 }} - {{ end }} -{{ end }} - -{{ print (lang.FormatNumberCustom 0 $count) " " "Drafts" }} +{{- print (lang.FormatNumberCustom 0 (len $filteredPages)) -}} diff --git a/themes/default/layouts/partials/count-feeds.html b/themes/default/layouts/partials/count-feeds.html index 0b8cacc..68495da 100644 --- a/themes/default/layouts/partials/count-feeds.html +++ b/themes/default/layouts/partials/count-feeds.html @@ -1,14 +1,7 @@ -{{- $author := partial "function-authors-data.html" . -}} -{{- $author = $author.user -}} +{{- $author := .Section -}} -{{ $count := 0 }} +{{- $feeds := where .Site.Pages "Params.feed" "ne" nil -}} +{{- $authors := where .Site.Pages "Section" $author -}} +{{- $filteredPages := $authors | intersect $feeds -}} -{{ range .Site.Pages }} - {{ if .Params.feed }} - {{ if eq .Type $author }} - {{ $count = add $count 1 }} - {{ end }} - {{ end }} -{{ end }} - -{{ print (lang.FormatNumberCustom 0 $count) " " "Messages" }} +{{- print (lang.FormatNumberCustom 0 (len $filteredPages)) -}} diff --git a/themes/default/layouts/partials/count-likes.html b/themes/default/layouts/partials/count-likes.html deleted file mode 100644 index 3b8a9ef..0000000 --- a/themes/default/layouts/partials/count-likes.html +++ /dev/null @@ -1,12 +0,0 @@ -{{- $author := partial "function-authors-data.html" . -}} -{{- $author = $author.user -}} - -{{ $count := 0 }} - -{{ range .Site.Pages }} - {{ if and (eq .Type $author) .Params.Liked }} - {{ $count = add $count 1 }} - {{ end }} -{{ end }} - -{{ print (lang.FormatNumberCustom 0 $count) " " "Messages" }} diff --git a/themes/default/layouts/partials/count-marks.html b/themes/default/layouts/partials/count-marks.html new file mode 100644 index 0000000..deb532d --- /dev/null +++ b/themes/default/layouts/partials/count-marks.html @@ -0,0 +1,6 @@ +{{- $author := .Section -}} +{{- $items := where .Site.RegularPages ".Params.marked" true -}} +{{- $authors := where .Site.RegularPages "Section" $author -}} +{{- $filteredPages := $authors | intersect $items -}} + +{{- print (lang.FormatNumberCustom 0 (len $filteredPages)) -}} diff --git a/themes/default/layouts/partials/count-media.html b/themes/default/layouts/partials/count-media.html index 13782cc..1d68e0a 100644 --- a/themes/default/layouts/partials/count-media.html +++ b/themes/default/layouts/partials/count-media.html @@ -1,19 +1,20 @@ -{{- $author := partial "function-authors-data.html" . -}} -{{- $author = $author.user -}} +{{- $author := .Section -}} +{{- $notFeeds := where .Site.RegularPages "Params.feed" "eq" nil -}} +{{- $authors := where .Site.RegularPages "Section" $author -}} +{{- $filteredPages := $authors | intersect $notFeeds -}} +{{- $count := 0 -}} -{{ $count := 0 }} +{{- range first 100 $filteredPages -}} + {{- if eq $count 10 -}} + {{- break -}} + {{- end -}} + {{- if or + (in .Content "</video>") + (in .Content "</picture>") + (in .Content "</youtube-video>") + -}} + {{- $count = add $count 1 -}} + {{- end -}} +{{- end -}} -{{ range .Site.Pages }} - {{ if or - (in .Content "<figure>") - (in .Content "<imgur-video>") - (in .Content "<youtube-video>") - (in .Content "<video-container>") - }} - {{ if eq .Type $author }} - {{ $count = add $count 1 }} - {{ end }} - {{ end }} -{{ end }} - -{{ print (lang.FormatNumberCustom 0 $count) " " "Messages" }} +{{- print (lang.FormatNumberCustom 0 $count) -}} diff --git a/themes/default/layouts/partials/count-tags.html b/themes/default/layouts/partials/count-tags.html index 0ef6802..6d436c6 100644 --- a/themes/default/layouts/partials/count-tags.html +++ b/themes/default/layouts/partials/count-tags.html @@ -1 +1 @@ -{{- print (lang.FormatNumberCustom 0 (len .Site.Taxonomies.tags)) " " "Tags" -}} +{{- print (lang.FormatNumberCustom 0 (len .Site.Taxonomies.tags)) -}} diff --git a/themes/default/layouts/partials/count-total-messages.html b/themes/default/layouts/partials/count-total-messages.html deleted file mode 100644 index 10540a7..0000000 --- a/themes/default/layouts/partials/count-total-messages.html +++ /dev/null @@ -1,2 +0,0 @@ -{{ $messages := len .Site.RegularPages }} -{{ print (lang.FormatNumberCustom 0 $messages) " " "Messages" }} diff --git a/themes/default/layouts/partials/count.html b/themes/default/layouts/partials/count.html new file mode 100644 index 0000000..72b5d03 --- /dev/null +++ b/themes/default/layouts/partials/count.html @@ -0,0 +1 @@ +{{- print (lang.FormatNumberCustom 0 (len .Site.RegularPages)) -}} diff --git a/themes/default/layouts/partials/following-list.html b/themes/default/layouts/partials/following-list.html index 165d699..510d3d2 100644 --- a/themes/default/layouts/partials/following-list.html +++ b/themes/default/layouts/partials/following-list.html @@ -1,14 +1,30 @@ +{{- $count := 0 -}} {{- $author := partial "function-authors-data.html" . -}} -{{- $following := print "public/" $author.user "/following.html" -}} +{{- $feeds := print "public/" .Section "/following.html" -}} + +{{- with $items := $author.feeds.rss -}} + {{- $count = len $items -}} +{{- end -}} + +{{- $expand := cond (gt $count 3) "more" "less" -}} <following-list> - <h1>Following</h1> + <details + id="web-feeds" + data-expand="{{- $expand -}}" + > + <summary> + <h1>Web Feeds ({{ $count }})</h1> + </summary> + </details> <aside> - {{- if and $author.feeds.rss (fileExists $following) -}} - {{- (resources.Get $following).Content | safeHTML -}} + {{- if and $author.feeds.rss (fileExists $feeds) -}} + {{- with $feeds = resources.Get $feeds -}} + {{- $feeds.Content | safeHTML -}} + {{- end -}} {{- else -}} <footer> - <code>No feeds found!</code> + <code>No items found!</code> </footer> {{- end -}} </aside> diff --git a/themes/default/layouts/partials/footer.html b/themes/default/layouts/partials/footer.html new file mode 100644 index 0000000..54d6ab1 --- /dev/null +++ b/themes/default/layouts/partials/footer.html @@ -0,0 +1,14 @@ +{{- $kind := in (slice "home" "taxonomy" "term") .Page.Kind -}} +{{- $author := index .Site.Data.authors .Section -}} + +<footer> + {{- if $kind -}} + {{- with $footer := (and $kind .Site.Author.default.footer) -}} + {{ $footer | markdownify }} · + Copyright © {{ now | time.Format "2006"}} · + {{- end -}} + {{- else -}} + {{ or $author.footer $author.title | markdownify }} · + {{- end }} + <a href="/sitemap.xml" >Site Map</a> +</footer> diff --git a/themes/default/layouts/partials/function-authors-data.html b/themes/default/layouts/partials/function-authors-data.html index f2ef800..dbc2c67 100644 --- a/themes/default/layouts/partials/function-authors-data.html +++ b/themes/default/layouts/partials/function-authors-data.html @@ -1,9 +1,9 @@ -{{- $input := or .Data.Context . -}} +{{- $input := . -}} {{- $pageContext := $input -}} -{{- $authorDefaultUser := or .Data.AuthorDefaultUser $pageContext.Site.Author.default.user -}} +{{- $author := $pageContext.Section -}} -{{- $output := index $pageContext.Site.Data ((or $pageContext.Params.author $authorDefaultUser) | default "default") -}} +{{- $output := index $pageContext.Site.Data.authors $author -}} {{- return $output -}} diff --git a/themes/default/layouts/partials/function-authors-slice.html b/themes/default/layouts/partials/function-authors-slice.html index a469fdd..fc25554 100644 --- a/themes/default/layouts/partials/function-authors-slice.html +++ b/themes/default/layouts/partials/function-authors-slice.html @@ -1,7 +1,9 @@ {{- $authors := slice -}} -{{- range $index, $author := .Site.Data -}} - {{- $authors = $authors | append $author.user -}} +{{- range $user := .Site.Author.list -}} + {{- with $author := index $.Site.Data.authors $user -}} + {{- $authors = $authors | append $author.user -}} + {{- end -}} {{- end -}} {{- return (uniq $authors) -}} diff --git a/themes/default/layouts/partials/function-content.html b/themes/default/layouts/partials/function-content.html index f206a03..19c15ea 100644 --- a/themes/default/layouts/partials/function-content.html +++ b/themes/default/layouts/partials/function-content.html @@ -2,13 +2,6 @@ {{- $content := $pageContext.Content -}} {{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}} -{{- - $content = $content | - replaceRE "<p><figure>" "<figure>" | - replaceRE "<p>\n<figure>" "<figure>" | - replaceRE "</figure></p>" "</figure>" | --}} - {{- $brokenBlockquotes := findRE `(?sU)</blockquote>\n<p>(–|—).*</p>` .Content -}} {{- range $brokenBlockquote := $brokenBlockquotes -}} diff --git a/themes/default/layouts/partials/function-favicon-domain.html b/themes/default/layouts/partials/function-favicon-domain.html index f73ad62..3814304 100644 --- a/themes/default/layouts/partials/function-favicon-domain.html +++ b/themes/default/layouts/partials/function-favicon-domain.html @@ -2,10 +2,9 @@ {{- $output := (print - "https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=" + "https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&size=64&url=" "http://" $input - "&size=64" ) -}} diff --git a/themes/default/layouts/partials/function-generate-feeds.html b/themes/default/layouts/partials/function-generate-feeds.html index 42ffd8b..57789b5 100644 --- a/themes/default/layouts/partials/function-generate-feeds.html +++ b/themes/default/layouts/partials/function-generate-feeds.html @@ -19,7 +19,7 @@ {{- with $fetch | transform.Unmarshal -}} {{- $content := "" -}} - {{- $date := now.Format "2006-01-02T15:04:05Z" -}} + {{- $date := now | time.Format "2006-01-02T15:04:05Z" -}} {{- $description := "" -}} {{- $enclosure := "" -}} {{- $imageLink := "" -}} @@ -136,7 +136,7 @@ {{- end -}} - {{- $sourceDomain := ($sourceLink | plainify | html | htmlUnescape | urls.Parse).Host -}} + {{- $sourceDomain := ($sourceLink | plainify | htmlUnescape | urls.Parse).Host -}} {{- /* Replace invalid time zones. */ -}} {{- $date = replaceRE "G[0-9]+T" "UTC" $date -}} @@ -158,23 +158,23 @@ {{- $feeds = $feeds | append (dict - "FeedContent" ($content | plainify | html | htmlUnescape) - "FeedContentShort" (delimit (first 2 (split ($content | plainify | html | htmlUnescape) "\n")) " " | truncate 250) - "FeedDate" ($date | plainify | html | htmlUnescape | time.Format "January 2, 2006") - "FeedDateTime" ($date | plainify | html | htmlUnescape | time.Format "2006-01-02T15:04:05Z") - "FeedDateTitle" ($date | plainify | html | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST") - "FeedDescription" ($description | plainify | html | htmlUnescape) - "FeedDescriptionShort" (delimit (first 2 (split ($description | plainify | html | htmlUnescape) "\n")) " " | truncate 250) - "FeedEnclosure" ($enclosure | plainify | html | htmlUnescape) - "FeedImageLink" ($imageLink | plainify | html | htmlUnescape) - "FeedLink" ($link | plainify | html | htmlUnescape) - "FeedName" (or $retitle (delimit (first 2 (split ($sourceTitle | plainify | html | htmlUnescape) " ")) " ")) - "FeedSourceDescription" ($sourceDescription | plainify | html | htmlUnescape) - "FeedSourceDomain" ($sourceDomain | plainify | html | htmlUnescape) - "FeedSourceLink" ($sourceLink | plainify | html | htmlUnescape) - "FeedSourceHome" ($sourceHome | plainify | html | htmlUnescape) - "FeedSourceTitle" ($sourceTitle | plainify | html | htmlUnescape) - "FeedTitle" ($title | plainify | html | htmlUnescape) + "FeedContent" ($content | plainify | htmlUnescape) + "FeedContentShort" (delimit (first 2 (split ($content | plainify | htmlUnescape) "\n")) " " | truncate 250 "...") + "FeedDate" ($date | plainify | htmlUnescape | time.Format "Mon Jan 2 2006") + "FeedDateTime" ($date | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z") + "FeedDateTitle" ($date | plainify | htmlUnescape | time.Format "Monday January 2 2006 at 15:04:05 MST") + "FeedDescription" ($description | plainify | htmlUnescape) + "FeedDescriptionShort" (delimit (first 2 (split ($description | plainify | htmlUnescape) "\n")) " " | truncate 250 "...") + "FeedEnclosure" ($enclosure | plainify | htmlUnescape) + "FeedImageLink" ($imageLink | plainify | htmlUnescape) + "FeedLink" ($link | plainify | htmlUnescape) + "FeedName" (or $retitle (delimit (first 2 (split ($sourceTitle | plainify | htmlUnescape) " ")) " ")) + "FeedSourceDescription" ($sourceDescription | plainify | htmlUnescape) + "FeedSourceDomain" ($sourceDomain | plainify | htmlUnescape) + "FeedSourceLink" ($sourceLink | plainify | htmlUnescape) + "FeedSourceHome" ($sourceHome | plainify | htmlUnescape) + "FeedSourceTitle" ($sourceTitle | plainify | htmlUnescape) + "FeedTitle" ($title | plainify | htmlUnescape) ) -}} @@ -229,12 +229,12 @@ "description" (or .FeedSourceDescription .FeedSourceTitle "No source description found.") "domain" .FeedSourceDomain "enclosure" .FeedEnclosure - "favicon" $imageSource.RelPermalink + "favicon" (strings.TrimPrefix ("" | absURL) $imageSource.Permalink) "home" .FeedSourceHome "link" .FeedLink "name" .FeedName "source" .FeedSourceLink - "tags" "[rss]" + "tags" "[feeds]" ) $template -}} diff --git a/themes/default/layouts/partials/function-page-modified.html b/themes/default/layouts/partials/function-page-modified.html index 0b53acb..43bea9f 100644 --- a/themes/default/layouts/partials/function-page-modified.html +++ b/themes/default/layouts/partials/function-page-modified.html @@ -1,26 +1,34 @@ -{{- $input := . -}} +{{- $input := .Context -}} +{{- $disable := or .Disable false -}} {{- $pageContext := $input -}} +{{- $format := or .Format "index.html" -}} -{{- $markdown := print "content/" $pageContext.File -}} -{{- $markdownModTime := "" -}} {{- $page := print "public/" (strings.TrimPrefix $pageContext.Page.Site.BaseURL $pageContext.Page.Permalink - ) "index.html" + ) $format -}} + {{- $pageModTime := "" -}} +{{- $markdownModTime := "" -}} +{{- $markdownContent := print "content/" $pageContext.File -}} +{{- $markdownPublic := print "public/data/generates/content/" $pageContext.File -}} + +{{- if fileExists $markdownContent -}} + {{- $markdownModTime = (os.Stat $markdownContent).ModTime -}} +{{- end -}} -{{- if fileExists $markdown -}} - {{- $markdownModTime = (os.Stat $markdown).ModTime -}} +{{- if fileExists $markdownPublic -}} + {{- $markdownModTime = (os.Stat $markdownPublic).ModTime -}} {{- end -}} {{- if fileExists $page -}} {{- $pageModTime = (os.Stat $page).ModTime -}} {{- end -}} -{{- $modified := gt $markdownModTime $pageModTime -}} +{{- $page = gt $markdownModTime $pageModTime -}} -{{- $output := or $modified (in (slice +{{- $modified := or $page (in (slice "home" "section" "taxonomy" @@ -28,4 +36,4 @@ ) $pageContext.Page.Kind) -}} -{{- return $output -}} +{{- return (or $disable $modified) -}} diff --git a/themes/default/layouts/partials/gallery-walk.html b/themes/default/layouts/partials/gallery-walk.html index 6c2206f..ca95d3f 100644 --- a/themes/default/layouts/partials/gallery-walk.html +++ b/themes/default/layouts/partials/gallery-walk.html @@ -1,18 +1,9 @@ -{{- $data := slice -}} -{{- $author := partial "function-authors-data.html" . -}} +{{- $data := slice -}} +{{- $author := partial "function-authors-data.html" . -}} +{{- $filteredPages := partial "function-filters-content.html" .Site.RegularPages -}} -{{- $mimes := slice - "image/apng" - "image/avif" - "image/gif" - "image/jpeg" - "image/png" - "image/svg+xml" - "image/webp" --}} - -{{- range (where .Site.RegularPages "Params.Author" $author.user) -}} - {{- if in .Content "<figure>" -}} +{{- range (where $filteredPages "Section" $author.user) -}} + {{- if in .Content "<picture>" -}} {{- $data = $data | append (dict "alt" (delimit (findRE `(?sU)alt=".*"` .Content 1) "") "height" (delimit (findRE `(?sU)height=".*"` .Content 1) "") @@ -35,16 +26,20 @@ {{- range $image := $data }} <a href="{{ $image.relatedHref }}"> <picture> - <source - {{ $image.srcset | safeHTMLAttr }} - {{ $image.type | safeHTMLAttr }} - /> + {{- with $image.srcset -}} + <source + {{ $image.srcset | safeHTMLAttr }} + {{ $image.type | safeHTMLAttr }} + /> + {{- end -}} <img loading="lazy" {{ $image.alt | safeHTMLAttr }} {{ $image.title | safeHTMLAttr }} + {{ with ne (index (last 1 (split $image.width "=")) 0) `""` }} {{ $image.width | safeHTMLAttr }} {{ $image.height | safeHTMLAttr }} + {{ end }} {{ $image.src | safeHTMLAttr }} {{ $image.style | safeHTMLAttr }} /> diff --git a/themes/default/layouts/partials/gallery.html b/themes/default/layouts/partials/gallery.html index 8aaa2c8..135aa14 100644 --- a/themes/default/layouts/partials/gallery.html +++ b/themes/default/layouts/partials/gallery.html @@ -7,7 +7,7 @@ {{- (resources.Get $gallery).Content | safeHTML -}} {{- else -}} <footer> - <code>No media found!</code> + <code>No items found!</code> </footer> {{- end -}} </aside> diff --git a/themes/default/layouts/partials/generate-authors.html b/themes/default/layouts/partials/generate-authors.html index 61cc5a6..d1fc0c2 100644 --- a/themes/default/layouts/partials/generate-authors.html +++ b/themes/default/layouts/partials/generate-authors.html @@ -1,13 +1,13 @@ -{{- range .Site.Author.list -}} +{{- range $author := .Site.Author.list -}} - {{- if not (fileExists (print "data/" . ".yaml")) -}} + {{- if not (fileExists (print "data/authors/" $author ".yaml")) -}} {{- $configuration := resources.Get "templates/author.yaml" -}} {{- $configuration := resources.ExecuteAsTemplate - (print "/data/generates/authors/" . ".yaml") + (print "/data/generates/authors/" $author ".yaml") (dict - "Name" (title .) - "User" . + "Name" (title $author) + "User" $author ) $configuration -}} @@ -18,9 +18,9 @@ {{- $markdown := resources.Get "templates/markdown-frontmatter.yaml" -}} {{- $template := resources.ExecuteAsTemplate - (print "/data/generates/content/" . "/" "_index.md") + (print "/data/generates/content/" $author "/" "_index.md") (dict - "author" . + "author" $author "layout" "section" ) $markdown @@ -28,9 +28,9 @@ {{- $writeToFile := $template.Permalink -}} {{- $template := resources.ExecuteAsTemplate - (print "/data/generates/content/" . "/feeds/" "_index.md") + (print "/data/generates/content/" $author "/feeds/" "_index.md") (dict - "author" . + "author" $author "layout" "section.feeds" ) $markdown @@ -38,9 +38,9 @@ {{- $writeToFile := $template.Permalink -}} {{- $template := resources.ExecuteAsTemplate - (print "/data/generates/content/" . "/media/" "_index.md") + (print "/data/generates/content/" $author "/media/" "_index.md") (dict - "author" . + "author" $author "layout" "section.media" ) $markdown @@ -48,19 +48,19 @@ {{- $writeToFile := $template.Permalink -}} {{- $template := resources.ExecuteAsTemplate - (print "/data/generates/content/" . "/likes/" "_index.md") + (print "/data/generates/content/" $author "/marks/" "_index.md") (dict - "author" . - "layout" "section.likes" + "author" $author + "layout" "section.marks" ) $markdown -}} {{- $writeToFile := $template.Permalink -}} {{- $template := resources.ExecuteAsTemplate - (print "/data/generates/content/" . "/drafts/" "_index.md") + (print "/data/generates/content/" $author "/drafts/" "_index.md") (dict - "author" . + "author" $author "layout" "section.drafts" ) $markdown diff --git a/themes/default/layouts/partials/base-canonical.html b/themes/default/layouts/partials/head-canonical.html index 051e450..051e450 100644 --- a/themes/default/layouts/partials/base-canonical.html +++ b/themes/default/layouts/partials/head-canonical.html diff --git a/themes/default/layouts/partials/base-csp.html b/themes/default/layouts/partials/head-csp.html index d34043e..d34043e 100644 --- a/themes/default/layouts/partials/base-csp.html +++ b/themes/default/layouts/partials/head-csp.html diff --git a/themes/default/layouts/partials/head-css.html b/themes/default/layouts/partials/head-css.html new file mode 100644 index 0000000..6e9eb56 --- /dev/null +++ b/themes/default/layouts/partials/head-css.html @@ -0,0 +1,26 @@ +{{- $default := resources.Get "css/default.css" -}} +{{- $syntax := resources.Get "css/default-syntax.css" -}} +{{- $simple := resources.Get "css/default-simple.css" -}} +{{- $fast := resources.Get "css/default-fast.css" -}} +{{- $math := resources.Get "css/default-mathml.css" -}} + +{{- $css := + slice + $default + $syntax + | resources.Concat "css/bundle.css" + | resources.Minify + | fingerprint +-}} + +{{ if .Site.Params.site.production }} +<link rel="stylesheet" href="{{ $css.Permalink }}" title="Default" /> +{{ else }} +<link rel="stylesheet" href="{{ $default.Permalink }}" title="Default" /> +<link rel="stylesheet" href="{{ $syntax.Permalink }}" /> +{{ end }} + +<link rel="stylesheet" href="{{ $math.Permalink }}" /> + +<link rel="alternate stylesheet" href="{{ $simple.Permalink }}" /> +<link rel="alternate stylesheet" href="{{ $fast.Permalink }}" /> diff --git a/themes/default/layouts/partials/base-description.html b/themes/default/layouts/partials/head-description.html index 94b10c2..89e4691 100644 --- a/themes/default/layouts/partials/base-description.html +++ b/themes/default/layouts/partials/head-description.html @@ -4,5 +4,5 @@ {{ .Summary }} {{- else -}} {{- block "description" . -}}{{- end -}} - {{- partial "base-title.html" . -}} + {{- partial "head-title.html" . -}} {{- end -}} diff --git a/themes/default/layouts/partials/head-discovery.html b/themes/default/layouts/partials/head-discovery.html new file mode 100644 index 0000000..8c7272f --- /dev/null +++ b/themes/default/layouts/partials/head-discovery.html @@ -0,0 +1,62 @@ +{{- $author := partial "function-authors-data.html" . -}} + +{{- with (eq .Page.Kind "home") -}} +<link + rel="alternate" + type="application/rss+xml" + title="{{ $.Site.Title }} Feed" + href="{{ "" | absURL }}/rss.xml" +/> + + {{- range $author := $.Site.Sections }} + <link + rel="alternate" + type="application/rss+xml" + title="{{ $author.Page.Type }}'s Feed" + href="{{ print $author.Permalink "rss.xml" | absURL }}" + /> + {{ end }} +{{- end -}} + +{{- with (eq .Page.Kind "section") -}} +<link + rel="alternate" + type="application/rss+xml" + title="{{ $author.name }}'s Feed" + href="{{ print ("" | absURL) "/" $.Section }}/rss.xml" +/> + +{{- with $author.feeds.rss }} + {{ range $author.feeds.rss }} + {{ $data := split . " " }} + {{- $url := delimit (first 1 $data) "" -}} + {{- $retitle := trim (delimit (after 1 $data) " ") " " -}} + {{- $retitle := and $retitle (print $retitle "'s Feed") -}} + + <link + rel="alternate" + type="application/rss+xml" + title="{{ or $retitle $url }}" + href="{{ $url }}" + /> + {{ end }} +{{ end }} +{{- end -}} + +{{- with (eq .Page.Kind "taxonomy") -}} +<link + rel="alternate" + type="application/rss+xml" + title="{{ $.Title }} Feed" + href="{{ $.Permalink }}rss.xml" +/> +{{- end -}} + +{{- with (eq .Page.Kind "term") -}} +<link + rel="alternate" + type="application/rss+xml" + title="#{{ lower $.Title }} Tag Feed" + href="{{ $.Permalink }}rss.xml" +/> +{{- end }} diff --git a/themes/default/layouts/partials/head-embed.html b/themes/default/layouts/partials/head-embed.html new file mode 100644 index 0000000..e9c44d7 --- /dev/null +++ b/themes/default/layouts/partials/head-embed.html @@ -0,0 +1,4 @@ +<head> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + {{- partial "head-css.html" . -}} +</head> diff --git a/themes/default/layouts/partials/base-js.html b/themes/default/layouts/partials/head-js.html index a491eee..a491eee 100644 --- a/themes/default/layouts/partials/base-js.html +++ b/themes/default/layouts/partials/head-js.html diff --git a/themes/default/layouts/partials/head-manifest.html b/themes/default/layouts/partials/head-manifest.html new file mode 100644 index 0000000..52be1f9 --- /dev/null +++ b/themes/default/layouts/partials/head-manifest.html @@ -0,0 +1,58 @@ +{{- $author := .Section -}} +{{- $home := or ("" | absURL) "/" -}} +{{- $kind := in (slice "home" "taxonomy" "term") .Page.Kind -}} +{{- $logo := .Site.Params.webmanifest.logo -}} +{{- $profile := print "public/data/media/" $author "/" $author "-profile" -}} + +{{- if not $kind -}} + {{- $home = print ("" | absURL) "/" $author "/" -}} + {{- if fileExists (print $profile ".gif") -}} {{- $logo = (print $profile ".gif") -}} {{- end -}} + {{- if fileExists (print $profile ".webp") -}} {{- $logo = (print $profile ".webp") -}} {{- end -}} + {{- if fileExists (print $profile ".png") -}} {{- $logo = (print $profile ".png") -}} {{- end -}} +{{- end -}} + +{{- with $logo = resources.Get $logo -}} + +{{- $16 := $logo.Fit "16x16" -}} +{{- $32 := $logo.Fit "32x32" -}} +{{- $180 := $logo.Fit "180x180" -}} +{{- $192 := $logo.Fit "192x192" -}} +{{- $512 := $logo.Fit "512x512" -}} + +{{- if (eq $.Page.Kind "home") -}} + {{- $writeToFile := ($32.Content | resources.FromString "/favicon.ico").Permalink -}} +{{- end -}} + +<link rel="icon" type="image/x-icon" sizes="32x32" href="data:image/ico;base64,{{ $32.Content | base64Encode }}" /> +<link rel="icon" type="{{ $16.MediaType }}" sizes="16x16" href="data:{{ $16.MediaType }};base64,{{ $16.Content | base64Encode }}" /> +<link rel="icon" type="{{ $32.MediaType }}" sizes="32x32" href="data:{{ $32.MediaType }};base64,{{ $32.Content | base64Encode }}" /> +<link rel="apple-touch-icon" type="{{ $180.MediaType }}" sizes="180x180" href="data:{{ $180.MediaType }};base64,{{ $180.Content | base64Encode }}" /> + +<link rel="home" href="{{ $home }}" /> + +{{ "" -}} <!-- Newline --> + +{{- with $manifest := $.Site.Params.webmanifest -}} +<link rel="manifest" href='data:application/manifest+json,{{ merge $manifest (dict + "start_url" $home + "icons" (slice + (dict + "sizes" "192x192" + "src" (print "data:" $192.MediaType ";base64," ($192.Content | base64Encode)) + "type" (print $192.MediaType)) + (dict + "sizes" "512x512" + "src" (print "data:" $512.MediaType ";base64," ($512.Content | base64Encode)) + "type" (print $512.MediaType)))) + | jsonify + | urlquery +}}'> + +<meta name="msapplication-TileColor" content="#da532c" /> +<meta name="msapplication-config" content="none" /> +<meta name="msapplication-square70x70logo" content="none" /> +<meta name="msapplication-square150x150logo" content="data:{{ $180.MediaType }};base64,{{ $180.Content | base64Encode }}" /> +<meta name="msapplication-square310x310logo" content="none" /> +<meta name="msapplication-wide310x150logo" content="none" /> +{{- end -}} +{{- end -}} diff --git a/themes/default/layouts/partials/head-search.html b/themes/default/layouts/partials/head-search.html new file mode 100644 index 0000000..89113ab --- /dev/null +++ b/themes/default/layouts/partials/head-search.html @@ -0,0 +1,5 @@ +{{- with .Site.Params.search.verification -}} +{{- range $name, $content := . }} +<meta name="{{ $name }}" content="{{ $content }}" /> +{{- end }} +{{ end }} diff --git a/themes/default/layouts/partials/base-title.html b/themes/default/layouts/partials/head-title.html index b34355d..fff4530 100644 --- a/themes/default/layouts/partials/base-title.html +++ b/themes/default/layouts/partials/head-title.html @@ -1,4 +1,4 @@ -{{- $author := index .Site.Data ((or .Params.author .Site.Author.default.title) | default "default") -}} +{{- $author := index .Site.Data.authors .Section -}} {{- if not (eq .Title $.Site.Title) -}} {{- with $title := or .Title .Summary -}} diff --git a/themes/default/layouts/partials/head.html b/themes/default/layouts/partials/head.html new file mode 100644 index 0000000..1668d57 --- /dev/null +++ b/themes/default/layouts/partials/head.html @@ -0,0 +1,72 @@ +{{- $noindex := "" -}} +{{- $image := "" -}} +{{- $author := .Section -}} +{{- $kind := in (slice "home" "taxonomy" "term") .Page.Kind -}} + +{{- if not $kind -}} + {{- $image = print ("" | absURL) "/data/media/" $author "/" $author "-profile.png" -}} +{{- end -}} + +{{- with or .Params.Feed .Params.Unlisted .Params.ExpiryDate -}} + {{- $noindex = "noindex,nofollow" -}} +{{- end }} + +<!-- HTML Meta Tags --> +<meta charset="utf-8" /> +<meta name="author" content="{{ or $author $.Site.Title -}}" /> +<meta name="robots" content="{{ or $noindex .Site.Params.site.robots "index,follow" }}" /> +<meta name="viewport" content="width=device-width, initial-scale=1" /> +<meta name="keywords" content="{{- partial "head-title.html" . -}}" /> +<meta name="generator" content="Hugo {{ hugo.Version }}" /> + +<!-- Search Engine Tags --> +<meta itemprop="name" content="{{ partial "head-title.html" . -}}" /> +<meta itemprop="description" content="{{- partial "head-description.html" . -}}" /> +<meta itemprop="image" content="{{ $image }}" /> + +<!-- Open Graph Meta Tags --> +<meta property="og:title" content="{{ partial "head-title.html" . -}}" /> +<meta property="og:description" content="{{- partial "head-description.html" . -}}" /> +<meta property="og:url" content="{{ .Permalink }}" /> +<meta property="og:image" content="{{ $image }}" /> +<meta property="og:type" content="website" /> +<meta property="article:published_time" content="{{ (or .Params.PublishDate now.UTC) | time.Format "2006-01-02T15:04:05Z" }}" /> +<meta property="article:modified_time " content="{{ (or .Params.LastMod now.UTC) | time.Format "2006-01-02T15:04:05Z" }}" /> + +<!-- Twitter Meta Tags --> +<meta name="twitter:card" content="summary_large_image" /> +<meta name="twitter:title" content="{{ partial "head-title.html" . -}}" /> +<meta name="twitter:description" content="{{- partial "head-description.html" . -}}" /> +<meta name="twitter:image" content="{{ $image }}" /> + +<!-- Extra Meta Tags --> +<meta name='base-url' content="{{ "" | absURL }}" /> +<meta name='last-modified' content="{{ now.UTC.Format "Mon, 02 Jan 2006 15:04:05 GMT" }}" /> + +<!-- Search Verification --> +{{- partial "head-search.html" . -}} + +<!-- Feed Discovery --> +{{- partial "head-discovery.html" . -}} + +<!-- Canonicalization --> +{{- partial "head-canonical.html" . -}} + +<!-- Styles --> +{{- partial "head-css.html" . -}} + +<!-- Scripts --> +{{- partial "head-js.html" . -}} + +<!-- Progressive Enhancement --> +{{- partial "head-manifest.html" . -}} + +<!-- Content Security Policy --> +{{- partial "head-csp.html" . -}} + +<!-- No Scripts --> +<noscript> + <style> + {{ safeCSS (readFile "assets/css/noscript.css") }} + </style> +</noscript> diff --git a/themes/default/layouts/partials/styles-image-gradient.html b/themes/default/layouts/partials/image-gradient.css.html index 794ea8b..794ea8b 100644 --- a/themes/default/layouts/partials/styles-image-gradient.html +++ b/themes/default/layouts/partials/image-gradient.css.html diff --git a/themes/default/layouts/partials/menu-datetime.html b/themes/default/layouts/partials/menu-datetime.html new file mode 100644 index 0000000..20ef50e --- /dev/null +++ b/themes/default/layouts/partials/menu-datetime.html @@ -0,0 +1,22 @@ +{{- $href := print .Permalink -}} + +<meta-datetime> + <a href="{{ $href }}"> + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/calendar.svg")) -}} + <time + data-type="localDate" + datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" + > + {{ .Date | time.Format "Jan 2 2006" -}} + </time> + </a> + <a href="{{ $href }}"> + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/clock.svg")) -}} + <time + data-type="localTime" + datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" + > + {{ .Date | time.Format "15:04 MST" -}} + </time> + </a> +</meta-datetime> diff --git a/themes/default/layouts/partials/menu-embed.html b/themes/default/layouts/partials/menu-embed.html new file mode 100644 index 0000000..1b03d27 --- /dev/null +++ b/themes/default/layouts/partials/menu-embed.html @@ -0,0 +1,8 @@ +{{- $href := print .Permalink -}} + +<meta-embed> + <a href="{{ print $href "embed.html" }}"> + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/code.svg")) -}} + <span>Embed</span> + </a> +</meta-embed> diff --git a/themes/default/layouts/partials/meta-markdown.html b/themes/default/layouts/partials/menu-markdown.html index 5300af5..6e54238 100644 --- a/themes/default/layouts/partials/meta-markdown.html +++ b/themes/default/layouts/partials/menu-markdown.html @@ -4,10 +4,10 @@ {{- $href := print .Site.BaseURL "/" (partial "function-paths.html").markdown $source -}} {{- $title := .File.LogicalName -}} - <micro-metadata-source> + <meta-source> <a href="{{ $href }}" title="{{ $title }}"> - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/code.svg")) -}} - <span>markdown</span> + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/square-letter-m.svg")) -}} + <span>Markdown</span> </a> - </micro-metadata-source> + </meta-source> {{- end -}} diff --git a/themes/default/layouts/partials/meta-permalink.html b/themes/default/layouts/partials/menu-permalink.html index 3ab09a2..6f19559 100644 --- a/themes/default/layouts/partials/meta-permalink.html +++ b/themes/default/layouts/partials/menu-permalink.html @@ -1,11 +1,11 @@ {{- $href := print .Permalink "#" (partial "card-id.html" .) -}} -<micro-metadata-permalink> +<meta-permalink> <a title="#{{ partial "card-id.html" . }}" href="{{ $href }}"> {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/link.svg")) -}} - <span>permalink</span> + <span>Permalink</span> {{- /* This comment removes trailing newlines and white spaces. */ -}} </a> {{- /* This comment removes trailing newlines and white spaces. */ -}} -</micro-metadata-permalink> +</meta-permalink> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/menu-plain.html b/themes/default/layouts/partials/menu-plain.html new file mode 100644 index 0000000..3dee808 --- /dev/null +++ b/themes/default/layouts/partials/menu-plain.html @@ -0,0 +1,9 @@ +{{- $href := print .Permalink -}} +{{- $plain := print $href "index.txt" -}} + +<meta-plain> + <a href="{{ $plain }}"> + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/notes.svg")) -}} + <span>Plaintext</span> + </a> +</meta-plain> diff --git a/themes/default/layouts/partials/meta-anchored.html b/themes/default/layouts/partials/meta-anchored.html index 31b910f..872f98e 100644 --- a/themes/default/layouts/partials/meta-anchored.html +++ b/themes/default/layouts/partials/meta-anchored.html @@ -1,19 +1,24 @@ -{{ if or .Weight .Params.Liked .Params.feed }} - <micro-metadata-anchored> +{{- if or .Weight .Params.Liked .Params.feed -}} + <meta-anchored> + {{- $author := .Section -}} {{- partial "meta-via.html" . -}} - {{ if .Weight }} - <anchored-pinned> + {{- if .Weight -}} + <a data-anchored="pinned"> {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/pinned.svg")) }} <span>Pinned</span> - </anchored-pinned> - {{ end }} + </a> + {{- end -}} - {{ if .Params.Liked }} - <anchored-liked> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/heart.svg")) }} - <span>Liked</span> - </anchored-liked> - {{ end }} - </micro-metadata-anchored> -{{ end }} + {{- if .Params.Marked -}} + <a + href="{{ "" | absURL }}/{{ $author }}/marks/#marks" + data-anchored="marked" + data-hover="" + > + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/bookmark.svg")) }} + <span>Marked</span> + </a> + {{- end -}} + </meta-anchored> +{{- end -}} diff --git a/themes/default/layouts/partials/meta-context-menu.html b/themes/default/layouts/partials/meta-context-menu.html deleted file mode 100644 index 977f938..0000000 --- a/themes/default/layouts/partials/meta-context-menu.html +++ /dev/null @@ -1,30 +0,0 @@ -{{- $id := partial "card-id.html" . -}} -{{- $href := print .Permalink -}} -{{- $plain := print $href "index.txt" -}} - -<micro-metadata-menu> - <context-control> - <label for="context-metadata-{{ $id }}"> - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-down-circle.svg")) -}} - <span>menu</span> - </label> - <input hidden type="checkbox" id="context-metadata-{{ $id }}" /> - <context-menu anchor> - {{- partial "meta-markdown.html" . -}} - <micro-metadata-plain> - <a href="{{ $plain }}"> - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/file-text.svg")) -}} - <span>plaintext</span> - </a> - </micro-metadata-plain> - {{- partial "meta-permalink.html" . -}} - <micro-metadata-datetime> - <a title="{{ .Date.Local | time.Format "15:04 Jan 2 2006" -}}" href="{{ $href }}"> - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/calendar.svg")) -}} - <span>{{ .Date.Local | time.Format "Jan 2 2006" | lower -}}</span> - </a> - </micro-metadata-datetime> - </context-menu> - </context-control> -</micro-metadata-menu> -{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-date-time.html b/themes/default/layouts/partials/meta-datetime.html index 5b26c68..e0329bb 100644 --- a/themes/default/layouts/partials/meta-date-time.html +++ b/themes/default/layouts/partials/meta-datetime.html @@ -1,14 +1,14 @@ -<micro-metadata-datetime -title="{{ .Date | time.Format "Posted: Monday, January 2, 2006 at 15:04:05 MST" }} -{{ if .Lastmod.After .Date }}{{ .Lastmod | time.Format "Edited: Monday, January 2, 2006 at 15:04:05 MST" }}{{ end }}"> +<meta-datetime +title="{{ .Date | time.Format "Posted: Monday January 2 2006 at 15:04:05 MST" }} +{{ if .Lastmod.After .Date }}{{ .Lastmod | time.Format "Edited: Monday January 2 2006 at 15:04:05 MST" }}{{ end }}"> {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/calendar.svg")) -}} <time datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}"> - {{ (.Date.Local | time.Format "15:04 Jan 2 2006") -}} + {{ (.Date | time.Format "Mon Jan 2 2006") -}} </time> {{- /* This comment removes trailing newlines and white spaces. */ -}} {{ if .Lastmod.After .Date }} <span>(edited)</span> {{- end -}} {{- /* This comment removes trailing newlines and white spaces. */ -}} -</micro-metadata-datetime> +</meta-datetime> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-draft.html b/themes/default/layouts/partials/meta-draft.html index 8662b32..d441b9a 100644 --- a/themes/default/layouts/partials/meta-draft.html +++ b/themes/default/layouts/partials/meta-draft.html @@ -1,9 +1,9 @@ {{- if .Draft -}} - <micro-metadata-draft> + <meta-draft> {{- /* This comment removes trailing newlines and white spaces. */ -}} <em> {{- /* This comment removes trailing newlines and white spaces. */ -}} - <a href="{{ .Site.BaseURL }}/{{ .Type }}/drafts/"> + <a href="{{ .Site.BaseURL }}/{{ .Type }}/drafts/#drafts"> {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/edit.svg")) -}} <span>Draft</span> {{- /* This comment removes trailing newlines and white spaces. */ -}} @@ -11,5 +11,5 @@ {{- /* This comment removes trailing newlines and white spaces. */ -}} </em> {{- /* This comment removes trailing newlines and white spaces. */ -}} - </micro-metadata-draft> + </meta-draft> {{- end -}} diff --git a/themes/default/layouts/partials/meta-expiry-date.html b/themes/default/layouts/partials/meta-expirydate.html index 6eef09e..1feefd1 100644 --- a/themes/default/layouts/partials/meta-expiry-date.html +++ b/themes/default/layouts/partials/meta-expirydate.html @@ -8,7 +8,7 @@ {{- $title = print "Self destructed" " " $date -}} {{- end -}} - <micro-metadata-expiry + <meta-expiry title="{{ $title }}"> {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/trash-2.svg")) -}} <time datetime= "{{- .ExpiryDate | time.Format "2006-01-02T15:04:05Z" -}}"> @@ -16,5 +16,5 @@ {{- /* This comment removes trailing newlines and white spaces. */ -}} </time> {{- /* This comment removes trailing newlines and white spaces. */ -}} - </micro-metadata-expiry> + </meta-expiry> {{- end -}} diff --git a/themes/default/layouts/partials/meta-handle.html b/themes/default/layouts/partials/meta-handle.html index da2070b..ee0cc50 100644 --- a/themes/default/layouts/partials/meta-handle.html +++ b/themes/default/layouts/partials/meta-handle.html @@ -1,7 +1,7 @@ {{- $author := .Section -}} -{{- $host := or (urls.Parse .Site.BaseURL).Host "localhost" -}} -{{- $href := print .Site.BaseURL "/" $author "/#" -}} +{{- $host := or (urls.Parse ("" | absURL)).Host "localhost" -}} +{{- $href := print ("" | absURL) "/" $author "/" -}} {{- $title := print $author "@" $host -}} @@ -11,7 +11,7 @@ {{- $title = $.Params.feed.domain -}} {{- end -}} -<micro-metadata-handle> +<meta-handle> {{- /* This comment removes trailing newlines and white spaces. */ -}} <a title="{{ $title }}" @@ -21,5 +21,5 @@ {{- /* This comment removes trailing newlines and white spaces. */ -}} </a> {{- /* This comment removes trailing newlines and white spaces. */ -}} -</micro-metadata-handle> +</meta-handle> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-menu.html b/themes/default/layouts/partials/meta-menu.html new file mode 100644 index 0000000..f5e127d --- /dev/null +++ b/themes/default/layouts/partials/meta-menu.html @@ -0,0 +1,23 @@ +{{- $id := partial "card-id.html" . -}} + +<menu> + <li> + <label for="context-metadata-{{ $id }}"> + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-down-circle.svg")) -}} + <span>menu</span> + </label> + </li> + <li> + <input hidden="" type="checkbox" id="context-metadata-{{ $id }}" /> + <context-menu position="anchor"> + + {{- partial "menu-markdown.html" . -}} + {{- partial "menu-plain.html" . -}} + {{- partial "menu-embed.html" . -}} + {{- partial "menu-permalink.html" . -}} + {{- partial "menu-datetime.html" . -}} + + </context-menu> + </li> +</menu> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-name.html b/themes/default/layouts/partials/meta-name.html index e381259..7c2ca61 100644 --- a/themes/default/layouts/partials/meta-name.html +++ b/themes/default/layouts/partials/meta-name.html @@ -1,6 +1,6 @@ {{- $author := partial "function-authors-data.html" . -}} -{{- $href := print .Site.BaseURL "/" $author.user "/#" -}} +{{- $href := print ("" | absURL) "/" $author.user "/" -}} {{- $name := $author.name -}} {{- $title := $name -}} @@ -10,8 +10,8 @@ {{- $title = $name -}} {{- end -}} -<micro-metadata-name title="{{ $title }}"> +<meta-name title="{{ $title }}"> <b><a href="{{ $href }}">{{ $name }}</a></b> {{- /* This comment removes trailing newlines and white spaces. */ -}} -</micro-metadata-name> +</meta-name> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-read-time.html b/themes/default/layouts/partials/meta-readtime.html index 69c0ffa..43b5303 100644 --- a/themes/default/layouts/partials/meta-read-time.html +++ b/themes/default/layouts/partials/meta-readtime.html @@ -4,9 +4,9 @@ {{- $seconds = "1" -}} {{- end -}} -<micro-metadata-readtime title="Takes {{ $seconds }} second{{- if not (eq $seconds "1") -}}s{{- end }} to read"> - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/clock.svg")) -}} - <span>{{ $seconds }} sec</span> +<meta-readtime title="{{ $seconds }} second{{- if not (eq $seconds "1") -}}s{{- end }} to read"> + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/eye.svg")) }} + <span>{{ $seconds }}s read</span> {{- /* This comment removes trailing newlines and white spaces. */ -}} -</micro-metadata-readtime> +</meta-readtime> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-tags.html b/themes/default/layouts/partials/meta-tags.html deleted file mode 100644 index cd13781..0000000 --- a/themes/default/layouts/partials/meta-tags.html +++ /dev/null @@ -1,6 +0,0 @@ -{{- with .Params.tags -}} - {{- range $tags, $tag := sort $.Params.tags }} - {{ $link := print ("tags/" | relURL) ($tag | urlize) "/" }} - {{- print "[#" $tag "](" $link ")" | markdownify -}} - {{- end -}} -{{- end -}} diff --git a/themes/default/layouts/partials/meta-unlisted.html b/themes/default/layouts/partials/meta-unlisted.html index 827de3c..df67e4e 100644 --- a/themes/default/layouts/partials/meta-unlisted.html +++ b/themes/default/layouts/partials/meta-unlisted.html @@ -1,7 +1,7 @@ {{- if .Params.Unlisted -}} - <micro-metadata-unlisted title="This message is off the record"> + <meta-unlisted title="This message is off the record"> {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/eye-off.svg")) -}} <span>unlisted</span> {{- /* This comment removes trailing newlines and white spaces. */ -}} - </micro-metadata-unlisted> + </meta-unlisted> {{- end -}} diff --git a/themes/default/layouts/partials/meta-via.html b/themes/default/layouts/partials/meta-via.html index 596749e..c34ca73 100644 --- a/themes/default/layouts/partials/meta-via.html +++ b/themes/default/layouts/partials/meta-via.html @@ -1,14 +1,13 @@ {{- $author := .Section -}} {{- if .Params.feed -}} -<anchored-via> - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/rss.svg")) -}} <a - data-hover - title="{{ $author }}@{{ or (urls.Parse .Site.BaseURL).Host "localhost" }}" - href="{{ .Site.BaseURL }}/{{ $author }}/feeds/#" + data-hover="" + data-anchored="via" + href="{{ "" | absURL }}/{{ $author }}/feeds/#feeds" + title="{{ $author }}@{{ or (urls.Parse ("" | absURL)).Host "localhost" }}" > + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/rss.svg")) -}} via @{{ $author }} </a> -</anchored-via> {{- end -}} diff --git a/themes/default/layouts/partials/meta-view.html b/themes/default/layouts/partials/meta-view.html index ccdac1c..33aee6b 100644 --- a/themes/default/layouts/partials/meta-view.html +++ b/themes/default/layouts/partials/meta-view.html @@ -1,12 +1,12 @@ {{- $href := or .Params.Feed.link .Permalink -}} -<micro-metadata-view> +<meta-view> {{- /* This comment removes trailing newlines and white spaces. */ -}} - <a href="{{ $href }}"> + <a href="{{ $href }}" title="{{- partial "meta-title.html" . -}}"> {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/external-link.svg")) -}} <span>view</span> {{- /* This comment removes trailing newlines and white spaces. */ -}} </a> {{- /* This comment removes trailing newlines and white spaces. */ -}} -</micro-metadata-view> +</meta-view> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/meta-word-count.html b/themes/default/layouts/partials/meta-wordcount.html index 8aaa30d..b6ec95e 100644 --- a/themes/default/layouts/partials/meta-word-count.html +++ b/themes/default/layouts/partials/meta-wordcount.html @@ -4,7 +4,7 @@ {{- $overLimit := sub .WordCount $limit -}} {{- $bitCount := lang.FormatNumberCustom 0 (len .Content) -}} -<micro-metadata-wordcount +<meta-wordcount title=" {{- if $wordLimit -}} {{ $overLimit }} words over the limit @@ -16,18 +16,18 @@ title=" "> {{- /* This comment removes trailing newlines and white spaces. */ -}} <word-limit> - {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/file-text.svg")) -}} + {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/notes.svg")) -}} <word-count> {{- if $wordLimit -}} <em>{{ .WordCount }}</em> {{- else -}} - {{ .WordCount }} + <sup>{{ .WordCount }}</sup> {{- end -}} - /{{ $limit }} words + /<sub>{{ $limit }}</sub> words {{- /* This comment removes trailing newlines and white spaces. */ -}} </word-count> {{- /* This comment removes trailing newlines and white spaces. */ -}} </word-limit> {{- /* This comment removes trailing newlines and white spaces. */ -}} -</micro-metadata-wordcount> +</meta-wordcount> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/navigator-middle.html b/themes/default/layouts/partials/navigator-middle.html index 46c4060..7259b43 100644 --- a/themes/default/layouts/partials/navigator-middle.html +++ b/themes/default/layouts/partials/navigator-middle.html @@ -1,22 +1,29 @@ -{{ $id := .Id }} -{{ $href := .Href }} +{{- $href := or .Href "#" -}} +{{- $id := or .Id "top" -}} +{{- $label := title $id -}} +{{- $icon := readFile (print (partial "function-paths.html").static "/icons/feather/arrow-up.svg") -}} +{{- $refresh := readFile (print (partial "function-paths.html").static "/icons/feather/refresh-cw.svg") -}} + +{{- with .Icon -}} + {{- $icon = readFile (print (partial "function-paths.html").static "/icons/feather/" . ".svg") -}} +{{- end -}} + +{{- with .IconLabel -}} + {{- $label = . -}} +{{- end -}} <nav> <icon-button> <a - id="{{ or $id "top" }}" - href="{{ or $href "#" }}" + data-update="" + id="{{ $id }}" + href="{{ $href }}" + target="_self" > - {{ with .Icon }} - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/" . ".svg")) }} - {{ else }} - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-up.svg")) }} - {{ end }} - {{ with .IconLabel }} - <small>{{ . }}</small> - {{ else }} - <small>Top</small> - {{ end }} + {{ safeHTML $icon }} + {{ safeHTML $refresh }} + <small>{{ $label }}</small> + <small>Update</small> </a> </icon-button> @@ -31,7 +38,7 @@ {{ if .Context.Site.Menus.main }} {{ range .Context.Site.Menus.main }} - <icon-navigator hidden> + <icon-navigator hidden=""> <icon-button> <a id="nav-middle-{{ path.Base .Identifier }}" href="{{ .URL | absURL }}"> {{ with .Identifier }} @@ -45,27 +52,24 @@ {{ end }} {{ end }} - <search-entry id="search-frame"> - <form - id="search-form" - action="https://lite.duckduckgo.com/lite/"> - <input required - id="search-input" - name="q" - value="" - type="search" - autocomplete="off" - spellcheck="false" + <search-box> + <form role="search" action="https://lite.duckduckgo.com/lite/"> + <input aria-autocomplete="list" aria-label="search input" + autocomplete="off" + id="search" + name="q" + required="" + spellcheck="false" + type="search" + value="" /> - <button id="search-submit"> + <button type="submit"> {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/search.svg")) }} <small>Search</small> </button> - <ul hidden id="search-results"></ul> + <ul hidden=""></ul> </form> - </search-entry> - </nav> - -<navigation-separator><hr hidden></navigation-separator> + </search-box> +</nav> diff --git a/themes/default/layouts/partials/navigator-right.html b/themes/default/layouts/partials/navigator-right.html index 573cb8f..c2e6f4c 100644 --- a/themes/default/layouts/partials/navigator-right.html +++ b/themes/default/layouts/partials/navigator-right.html @@ -1,26 +1,7 @@ {{- partial "author-list.html" . -}} -{{- if or - (eq .Page.Kind "page") - (eq .Page.Kind "section") --}} - +{{- if (in (slice "page" "section") .Page.Kind) -}} {{- partial "gallery.html" . -}} {{- partial "following-list.html" . -}} - -{{- end -}} - -{{- if or - (eq .Page.Kind "page") - (eq .Page.Kind "section") --}} - {{- partial "webring.html" . -}} - -{{- else -}} - - {{- range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.webring) -}} - {{- partial "webring.html" . -}} - {{- end -}} - {{- end -}} diff --git a/themes/default/layouts/partials/navigator.css.html b/themes/default/layouts/partials/navigator.css.html new file mode 100644 index 0000000..7485408 --- /dev/null +++ b/themes/default/layouts/partials/navigator.css.html @@ -0,0 +1,19 @@ +icon-navigator a[href="{{ "" | absURL }}{{ .Link }}"], +column-base[position="left"] nav a[href="{{ "" | absURL }}{{ .Link }}"] { + font-weight: 700; +} + +column-base[position="left"] nav a[href="{{ "" | absURL }}{{ .Link }}"] { + background-color: #f0f6ff; + background-color: var(--hover-background-alternate); +} + +icon-navigator a[href="{{ "" | absURL }}{{ .Link }}"] svg { + fill: #cce0ff; + fill: var(--icon-hover-background); +} + +icon-navigator a[href="{{ "" | absURL }}{{ .Link }}"]:focus svg { + fill: #cce0ff; + fill: var(--icon-focus-background); +} diff --git a/themes/default/layouts/partials/pagination.html b/themes/default/layouts/partials/pagination.html index fa3c85e..e64bfcf 100644 --- a/themes/default/layouts/partials/pagination.html +++ b/themes/default/layouts/partials/pagination.html @@ -1,67 +1,50 @@ {{- with .Paginator -}} - - {{- $first := "Newest" -}} - {{- $prev := "Newer" -}} - {{- $next := "Older" -}} - {{- $last := "Oldest" -}} - {{- $invisible := "data-invisible" -}} - - {{- $firstData := $invisible -}} - {{- $firstHref := "" -}} - {{- $firstTitle := $first -}} + {{- $firstTitle := "hidden" -}} + {{- $prevTitle := "hidden" -}} + {{- $nextTitle := "hidden" -}} + {{- $lastTitle := "hidden" -}} + {{- $firstHref := "/" -}} + {{- $prevHref := "/" -}} + {{- $nextHref := "/" -}} + {{- $lastHref := "/" -}} {{- if and .HasPrev .First -}} - {{- $firstData = "" -}} - {{- $firstHref = .First.URL -}} + {{- $firstHref = .First.URL | absURL -}} + {{- $firstTitle = "Newest" -}} {{- end -}} - {{- $prevData := $invisible -}} - {{- $prevHref := "" -}} - {{- $prevRel := "prev" -}} - {{- $prevTitle := $prev -}} - {{- with .Prev -}} - {{- $prevData = "" -}} - {{- $prevHref = .URL -}} + {{- $prevHref = .URL | absURL -}} + {{- $prevTitle = "Newer" -}} {{- end -}} - {{- $nextData := $invisible -}} - {{- $nextHref := "" -}} - {{- $nextRel := "next" -}} - {{- $nextTitle := $next -}} - {{- if .Next -}} - {{- $nextData = "" -}} - {{- $nextHref = .Next.URL -}} + {{- $nextHref = .Next.URL | absURL -}} + {{- $nextTitle = "Older" -}} {{- end -}} - {{- $lastData := $invisible -}} - {{- $lastHref := "" -}} - {{- $lastTitle := $last -}} - {{- if and .HasNext .Last -}} - {{- $lastData = "" -}} - {{- $lastHref = .Last.URL -}} + {{- $lastHref = .Last.URL | absURL -}} + {{- $lastTitle = "Oldest" -}} {{- end -}} - <paginator-navigation{{ if eq .TotalPages 1 }} hidden {{ end }}> - - <a {{ $firstData | safeHTMLAttr }} href="{{ $firstHref }}" title="{{ $firstTitle }}" > - {{ $firstTitle }} - </a> - - <a rel="{{ $prevRel }}" {{ $prevData | safeHTMLAttr }} href="{{ $prevHref }}" title="{{ $prevTitle }}"> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }} - {{ $prevTitle }} - </a> - - <a rel="{{ $nextRel }}" {{ $nextData | safeHTMLAttr }} href="{{ $nextHref }}" title="{{ $nextTitle }}"> - {{ $nextTitle }} - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }} - </a> - - <a {{ $lastData | safeHTMLAttr }} href="{{ $lastHref }}" title="{{ $lastTitle }}" > - {{ $lastTitle }} - </a> - </paginator-navigation> + <nav{{ if le .TotalPages 1 }} hidden="" {{ end }} data-type="pagination"> + <a rel="first" href="{{ $firstHref }}" title="{{ $firstTitle }}" > + <span>{{ $firstTitle }}</span> + </a> + + <a rel="prev" href="{{ $prevHref }}" title="{{ $prevTitle }}"> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }} + <span>{{ $prevTitle }}</span> + </a> + + <a rel="next" href="{{ $nextHref }}" title="{{ $nextTitle }}"> + <span>{{ $nextTitle }}</span> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }} + </a> + + <a rel="last" href="{{ $lastHref }}" title="{{ $lastTitle }}" data-count="{{ .TotalPages }}"> + <span>{{ $lastTitle }}</span> + </a> + </nav> {{- end -}} diff --git a/themes/default/layouts/partials/profile-tabs.html b/themes/default/layouts/partials/profile-tabs.html index e5c0385..1ca632b 100644 --- a/themes/default/layouts/partials/profile-tabs.html +++ b/themes/default/layouts/partials/profile-tabs.html @@ -1,13 +1,44 @@ {{- $author := partial "function-authors-data.html" . -}} +{{- $path := print ("" | absURL) "/" $author.user -}} <tab-bar> <nav> - <a href="{{ .Site.BaseURL }}/{{ $author.user }}">Messages</a> - <a href="{{ .Site.BaseURL }}/{{ $author.user }}/feeds/">Feeds</a> - <a href="{{ .Site.BaseURL }}/{{ $author.user }}/media/">Media</a> - <a href="{{ .Site.BaseURL }}/{{ $author.user }}/likes/">Likes</a> - {{- if .Site.BuildDrafts }} - <a data-draft href="{{ .Site.BaseURL }}/{{ $author.user }}/drafts/">Drafts</a> + <a + data-label="{{ $label := "Posts" }}{{ $label }}" + href="{{ $path }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> + + <a + data-label="{{ $label := "Feeds" }}{{ $label }}" + href="{{ $path }}/{{ lower $label }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> + + <a + data-label="{{ $label := "Media" }}{{ $label }}" + href="{{ $path }}/{{ lower $label }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> + + <a + data-label="{{ $label := "Marks" }}{{ $label }}" + href="{{ $path }}/{{ lower $label }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> + + {{- if $.Site.BuildDrafts }} + <a + data-draft="" + data-label="{{ $label := "Drafts" }}{{ $label }}" + href="{{ $path }}/{{ lower $label }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> {{- end }} </nav> </tab-bar> diff --git a/themes/default/layouts/partials/profile.html b/themes/default/layouts/partials/profile.html index fc68c0b..e0c339b 100644 --- a/themes/default/layouts/partials/profile.html +++ b/themes/default/layouts/partials/profile.html @@ -1,29 +1,20 @@ {{- $author := partial "function-authors-data.html" . -}} -<micro-header> +<profile-box> + <picture data-type="banner"> + {{ partial "author-header.html" . }} + </picture> - <micro-header-banner> - <picture> - {{ partial "author-header.html" . }} - </picture> - </micro-header-banner> - - <micro-header-picture> - <picture> - {{ partial "author-picture.html" . }} - </picture> - </micro-header-picture> + <picture data-type="profile"> + {{ partial "author-picture.html" . }} + </picture> <section> - <micro-header-title> + <aside> <h2>{{ $author.name }}</h2> <h3>@{{ $author.user }}</h3> - </micro-header-title> - <micro-header-description> - <p> - {{ $author.description | markdownify }} - </p> - </micro-header-description> + </aside> + <p>{{ $author.description | markdownify }}</p> </section> <footer> @@ -42,11 +33,10 @@ <span>{{- $author.epoch | markdownify -}}</span> </p> <p> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/user.svg")) }} - <span><b>{{ with $author.feeds.rss }}{{ len . }}{{ else }} 0 {{ end }}</b> Following</span> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/tabler/rss.svg")) }} + <span><b>{{ with $author.feeds.rss }}{{ len . }}{{ else }} 0 {{ end }}</b> Feeds</span> </p> </footer> +</profile-box> - {{ partial "profile-tabs.html" . }} - -</micro-header> +{{- partial "profile-tabs.html" . -}} diff --git a/themes/default/layouts/partials/render-embed.html b/themes/default/layouts/partials/render-embed.html new file mode 100644 index 0000000..77b6b8f --- /dev/null +++ b/themes/default/layouts/partials/render-embed.html @@ -0,0 +1,31 @@ +{{- $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 -}} + {{- $pageContext.Render "summary" -}} +{{- else -}} + {{- with $embed := resources.Get $page -}} + {{- range $chunks := after 1 (split ($embed.Content) "</head>") -}} + {{- $chunks | safeHTML -}} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/themes/default/layouts/partials/rss-tags.html b/themes/default/layouts/partials/rss-tags.html deleted file mode 100644 index a54b628..0000000 --- a/themes/default/layouts/partials/rss-tags.html +++ /dev/null @@ -1,5 +0,0 @@ -{{- with .Params.tags -}} - {{- range $tags, $tag := sort . }} - <a href="{{ "tags/" | absURL }}{{ $tag | urlize }}/">#{{ $tag }}</a> - {{- end }} -{{- end }} diff --git a/themes/default/layouts/partials/styles-navigator.html b/themes/default/layouts/partials/styles-navigator.html deleted file mode 100644 index 80ebcd6..0000000 --- a/themes/default/layouts/partials/styles-navigator.html +++ /dev/null @@ -1,14 +0,0 @@ -icon-navigator a[href="{{ "" | absURL }}{{ .Link }}"], -column-left nav a[href="{{ "" | absURL }}{{ .Link }}"] { - font-weight: 700; -} - -column-left nav a[href="{{ "" | absURL }}{{ .Link }}"] { - background-color: #f0f6ff; - background-color: var(--hover-background-alternate); -} - -icon-navigator a[href="{{ "" | absURL }}{{ .Link }}"] svg { - fill: #e5f0ff; - fill: var(--active-background-alternate); -} diff --git a/themes/default/layouts/partials/tags.html b/themes/default/layouts/partials/tags.html new file mode 100644 index 0000000..29202d0 --- /dev/null +++ b/themes/default/layouts/partials/tags.html @@ -0,0 +1,19 @@ +{{- $format := .Format -}} +{{- $pageContext := .Context -}} +{{- $path := "tags/" -}} +{{- $url := $path | relURL -}} + +{{- with $pageContext.Params.tags -}} + {{- range $tags, $tag := sort $pageContext.Params.tags -}} + {{- if (eq $format "rss") -}} + {{- $url = $path | absURL -}} + {{- end -}} + + {{- $link := print $url ((lower $tag) | urlize) "/" -}} + {{- print "[#" (lower $tag) "](" $link ")" | markdownify -}} + + {{- if (eq $format "rss") -}} {{- end }} + {{ end -}} +{{- else -}} + <a href="{{ "tags/" | absURL }}">#untagged</a> +{{- end -}} diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html index af1a50d..9e28e3d 100644 --- a/themes/default/layouts/partials/video-container.html +++ b/themes/default/layouts/partials/video-container.html @@ -6,8 +6,8 @@ {{- $public := print "public/" .Source -}} {{- $immutable := print (.RelURL | humanize | urlize) "-" (.Source | sha256 | truncate 8 "") -}} {{- $extension := path.Ext .Source -}} -{{- $fileCache := print $.Author "/media/" $immutable $extension -}} -{{- $notCached := not (fileExists (path.Join "public/" $fileCache)) -}} +{{- $storage := print $.Author "/media/" $immutable $extension -}} +{{- $cached := fileExists (path.Join "public/" $storage) -}} {{- if .Start -}} {{- $timestamp = print "#t=" .Start -}} @@ -21,7 +21,7 @@ {{- $timestamp = print "#t=" .Start "," .End -}} {{- end -}} -{{- if $notCached -}} +{{- if not $cached -}} {{- with $remote := cond (default true $.Context.Site.Params.site.offline) false (resources.GetRemote .Source) -}} {{- with .Err -}} {{- warnf "Video fetch %s" . -}} @@ -29,16 +29,15 @@ {{- $caption = "No local video data found for source" -}} {{- end -}} {{- else -}} - {{- $cache = . | resources.Copy $fileCache -}} + {{- $cache = $remote | resources.Copy $storage -}} {{- $cache = $cache.Permalink -}} {{- end -}} {{- else -}} {{- $caption = "Unable to load remote source data" -}} {{- end -}} {{- else -}} - {{- with $cache = resources.Get (path.Join "public/" $fileCache) -}} - {{- $cache = $cache.Content | resources.FromString $fileCache -}} - {{- $cache = $cache.Permalink -}} + {{- with $cache = resources.Get (path.Join "public/" $storage) -}} + {{- $cache = print ("" | absURL) (strings.TrimLeft "public" $cache) -}} {{- end -}} {{- end -}} diff --git a/themes/default/layouts/partials/webring.html b/themes/default/layouts/partials/webring.html index 9179280..009e2fc 100644 --- a/themes/default/layouts/partials/webring.html +++ b/themes/default/layouts/partials/webring.html @@ -9,7 +9,7 @@ </aside> {{ else }} <footer> - <code>No content found!</code> + <code>No items found!</code> </footer> {{ end }} </web-ring> diff --git a/themes/default/layouts/shortcodes/abbr.html b/themes/default/layouts/shortcodes/abbr.html index 2a87233..61a2e32 100644 --- a/themes/default/layouts/shortcodes/abbr.html +++ b/themes/default/layouts/shortcodes/abbr.html @@ -1,6 +1,6 @@ {{- $abbr := default "TL;DR:" (.Get "abbr" | default (.Get 0)) -}} {{- $title := default "Too long, didn't read" (.Get "title" | default (.Get 1)) -}} -{{- $hash := print (truncate 8 "" (sha256 $abbr)) .Ordinal -}} +{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $abbr)) .Ordinal -}} <input hidden="" type="checkbox" id="abbr-{{ $hash }}" /> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/attach.html b/themes/default/layouts/shortcodes/attach.html index f453da5..55b5744 100644 --- a/themes/default/layouts/shortcodes/attach.html +++ b/themes/default/layouts/shortcodes/attach.html @@ -1,37 +1,38 @@ -{{- $url := default "https://www.gutenberg.org/files/98/old/2city12p.pdf" (.Get "url" | default (.Get 0)) -}} +{{- $url := default "/canory/media/2city12p.pdf" (.Get "url" | default (.Get 0)) -}} {{- $title := default "Attachment" (.Get "title" | default (.Get 1)) -}} {{- $caption := default $title (.Get "caption" | default (.Get 2)) -}} {{- $remote := default "" (.Get "remote" | default (.Get 3)) -}} {{- $data := "" -}} {{- $cache := "" -}} -{{- $type := "application/octet-stream" -}} {{- $author := .Page.Section -}} -{{- $immutable := print $url | anchorize -}} {{- $extension := path.Ext $url -}} -{{- $fileCache := print $author "/media/" $immutable $extension -}} -{{- $notCached := not (fileExists (path.Join "public/" $fileCache)) -}} +{{- $immutable := print $url | anchorize -}} +{{- $localFile := path.Join "public/" $url -}} +{{- $type := "application/octet-stream" -}} +{{- $storage := print $author "/media/" $immutable $extension -}} +{{- $cached := fileExists (path.Join "public/" $storage) -}} -{{- if $notCached -}} +{{- if not $cached -}} {{- with $remote := cond (default true $.Page.Site.Params.site.offline) false (resources.GetRemote $url) -}} {{- with .Err -}} - {{- warnf "Attachment fetch %s" . -}} - {{- if not (fileExists $fileCache) -}} + {{- if not (fileExists $localFile) -}} {{- $caption = "No local attachment data found for source" -}} + {{- warnf "Attachment local fetch error: %s" $url -}} {{- end -}} {{- else -}} - {{- $type = .MediaType -}} - {{- $cache = . | resources.Copy $fileCache -}} + {{- $type = $remote.MediaType -}} + {{- $cache = $remote | resources.Copy $storage -}} {{- $cache = $cache.Permalink -}} {{- end -}} {{- else -}} {{- $caption = "Unable to load remote source data" -}} + {{- warnf "Attachment remote fetch error: %s" $url -}} {{- end -}} {{- else -}} - {{- with $cache = resources.Get (path.Join "public/" $fileCache) -}} + {{- with $cache = resources.Get (path.Join "public/" $storage) -}} {{- $type = .MediaType -}} - {{- $cache = $cache.Content | resources.FromString $fileCache -}} - {{- $cache = $cache.Permalink -}} + {{- $cache = print ("" | absURL) (strings.TrimLeft "public" $cache) -}} {{- end -}} {{- end -}} @@ -45,7 +46,7 @@ <object type="{{ $type }}" data="{{ $data }}"> <p> Your browser does not support the <code>{{ $type }}</code> plugin. Here's a - <a href="{{ $data }}">link to the file</a> instead. + <a rel="canonical" href="{{ $data }}">link to the file</a> instead. </p> </object> <footer> diff --git a/themes/default/layouts/shortcodes/disclose.html b/themes/default/layouts/shortcodes/disclose.html index 2cc99c7..231561b 100644 --- a/themes/default/layouts/shortcodes/disclose.html +++ b/themes/default/layouts/shortcodes/disclose.html @@ -1,10 +1,13 @@ {{- $text := default "Content Warning: " (.Get "text" | default (.Get 0)) -}} +{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $text)) .Ordinal -}} {{- if gt (len .Inner) 1 -}} {{- $text = .Inner -}} {{- end -}} -<details data-disclosure> - <summary>{{ (or $.Page.Params.title $text) | markdownify }}</summary> +<details id="disclosure-{{ $hash }}" data-disclosure=""> + <summary> + {{- (or $.Page.Params.title $text) | markdownify }} + </summary> </details> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/gist.html b/themes/default/layouts/shortcodes/gist.html deleted file mode 100644 index c475672..0000000 --- a/themes/default/layouts/shortcodes/gist.html +++ /dev/null @@ -1,9 +0,0 @@ -{{- $user := default "gdb" (.Get "user" | default (.Get 0)) -}} -{{- $gist := default "b6365e79be6052e7531e7ba6ea8caf23" (.Get "gist" | default (.Get 1)) -}} -{{- $file := default "" (.Get "file" | default (.Get 2)) -}} - -<github-gist> - <script - src="https://gist.github.com/{{ $user }}/{{ $gist }}.js?file={{ $file }}"> - </script> -</github-gist> diff --git a/themes/default/layouts/shortcodes/kbd.html b/themes/default/layouts/shortcodes/kbd.html index b24fd9d..63af975 100644 --- a/themes/default/layouts/shortcodes/kbd.html +++ b/themes/default/layouts/shortcodes/kbd.html @@ -1,3 +1,4 @@ {{- $key := default "Ctrl" (.Get "key" | default (.Get 0)) -}} <kbd title="{{ $key }}">{{ $key | markdownify }}</kbd> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/mark.html b/themes/default/layouts/shortcodes/mark.html index 122a521..1b9ef3d 100644 --- a/themes/default/layouts/shortcodes/mark.html +++ b/themes/default/layouts/shortcodes/mark.html @@ -1,9 +1,15 @@ {{- $text := default "mark" (.Get "text" | default (.Get 0)) -}} {{- $title := default "highlighted text" (.Get "title" | default (.Get 1)) -}} +{{- $id := default "" (.Get "id" | default (.Get 2)) -}} {{- if gt (len .Inner) 1 -}} - {{- $text = .Inner -}} + {{- $text = trim .Inner "\n" -}} {{- end -}} -<mark title="{{- $title -}}">{{- $text -}}</mark> +{{- if $id -}} + {{- $id = print "mark:" (truncate 30 "" $text | anchorize | replaceRE `\d` "") -}} + {{- $id = printf `id=%q` $id -}} +{{- end -}} + +<mark {{ $id | safeHTMLAttr }} title="{{- $title -}}"><span>{{- $text | markdownify -}}</span></mark> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/react.html b/themes/default/layouts/shortcodes/react.html index 344bd2d..ea96101 100644 --- a/themes/default/layouts/shortcodes/react.html +++ b/themes/default/layouts/shortcodes/react.html @@ -16,7 +16,7 @@ ) -}} -<reaction-tip title="{{ $title }}"> +<tool-tip data-type="reaction" title="{{ $title }}"> {{ $text | markdownify }} <a href="{{ $image.Permalink }}"> <img @@ -27,4 +27,4 @@ src="{{ $image.Permalink }}" /> </a> -</reaction-tip> +</tool-tip> diff --git a/themes/default/layouts/shortcodes/reddit.html b/themes/default/layouts/shortcodes/reddit.html deleted file mode 100644 index 10ef0b9..0000000 --- a/themes/default/layouts/shortcodes/reddit.html +++ /dev/null @@ -1,29 +0,0 @@ -{{- $path := default "linux/comments/aeufh6/vlc_has_now_reached_3_billions_downloads_and/edsvibz" (.Get "path" | default (.Get 0)) -}} -{{- $depth := default "2" (.Get "depth" | default (.Get 1)) -}} -{{- $context := default "1" (.Get "context" | default (.Get 2)) -}} -{{- $theme := default "light" (.Get "theme" | default (.Get 3)) -}} -{{- $showtitle := default "true" (.Get "showtitle" | default (.Get 4)) -}} -{{- $showedits := default "false" (.Get "showedits" | default (.Get 5)) -}} -{{- $showmedia := default "false" (.Get "showmedia" | default (.Get 6)) -}} -{{- $showmore := default "false" (.Get "showmore" | default (.Get 7)) -}} - -<reddit-comment> - <iframe loading="lazy" - id="reddit-embed" - src="https://www.redditmedia.com/r/{{ trim $path "/" }}/ -?depth={{ $depth }} -&embed=true -&showmore={{ $showmore }} -&showtitle={{ $showtitle }} -&context={{ $context }} -&showmedia={{ $showmedia }} -&theme={{ $theme }} -&showedits={{ $showedits }} -&created={{ now.Format "2006-01-02T15:04:05Z" }}" - sandbox="allow-scripts allow-same-origin allow-popups" - style="border: none;" - height="452" - width="640" - scrolling="no" - ></iframe> -</reddit-comment> diff --git a/themes/default/layouts/shortcodes/spoiler.html b/themes/default/layouts/shortcodes/spoiler.html index 5a9462d..9c5e59a 100644 --- a/themes/default/layouts/shortcodes/spoiler.html +++ b/themes/default/layouts/shortcodes/spoiler.html @@ -1,6 +1,6 @@ {{- $text := default "This is a spoiler." (.Get "text" | default (.Get 0)) -}} {{- $title := default "Click to show/hide text." (.Get "title" | default (.Get 1)) -}} -{{- $hash := print (truncate 8 "" (sha256 $text)) .Ordinal -}} +{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $text)) .Ordinal -}} {{- if gt (len .Inner) 1 -}} {{- $text = .Inner -}} diff --git a/themes/default/layouts/shortcodes/version.html b/themes/default/layouts/shortcodes/version.html index 11e7685..2e3eda8 100644 --- a/themes/default/layouts/shortcodes/version.html +++ b/themes/default/layouts/shortcodes/version.html @@ -1,12 +1,12 @@ -{{- $theme := "0.11.11" -}} -{{- $generator := "0.108.0" -}} +{{- $version := "0.11.12" -}} +{{- $generator := "0.110.0" -}} {{- $number := default false (.Get "number" | default (.Get 0)) -}} {{- $clone := default false (.Get "clone" | default (.Get 1)) -}} {{- $hugo := default false (.Get "hugo" | default (.Get 2)) -}} {{- if $number -}} - {{ $theme }} + {{ $version }} {{- end -}} {{- if $hugo -}} @@ -15,6 +15,6 @@ {{- if $clone -}} ```shell -git clone --branch {{ $theme }} https://www.thedroneely.com/git/thedroneely/canory +git clone --branch {{ $version }} https://www.thedroneely.com/git/thedroneely/canory ``` {{- end -}} diff --git a/themes/default/layouts/shortcodes/asciicast.html b/themes/default/layouts/shortcodes/video-ascii.html index 10da091..10da091 100644 --- a/themes/default/layouts/shortcodes/asciicast.html +++ b/themes/default/layouts/shortcodes/video-ascii.html diff --git a/themes/default/layouts/shortcodes/imgur-video.html b/themes/default/layouts/shortcodes/video-imgur.html index 2edb9a4..2edb9a4 100644 --- a/themes/default/layouts/shortcodes/imgur-video.html +++ b/themes/default/layouts/shortcodes/video-imgur.html diff --git a/themes/default/layouts/shortcodes/video.rss.xml b/themes/default/layouts/shortcodes/video.rss.xml index cff5974..be262e7 100644 --- a/themes/default/layouts/shortcodes/video.rss.xml +++ b/themes/default/layouts/shortcodes/video.rss.xml @@ -21,9 +21,9 @@ title="{{ $title }}" href="{{ $source }}" > - {{- $caption -}} + Video: {{ $caption -}} </a> </b> <br> - <span>{{ $caption }}</span> + <span>Title: {{ $title }}</span> </p> diff --git a/themes/default/layouts/shortcodes/vimeo.html b/themes/default/layouts/shortcodes/vimeo.html deleted file mode 100644 index 009ebb0..0000000 --- a/themes/default/layouts/shortcodes/vimeo.html +++ /dev/null @@ -1,12 +0,0 @@ -{{- $id := default "1084537" (.Get "id" | default (.Get 0)) -}} -{{- $title := default "Vimeo Video" (.Get "title" | default (.Get 1)) -}} - -<vimeo-video> - <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"> - <iframe loading="lazy" - src="https://player.vimeo.com/video/{{ $id }}?dnt=1" - style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" - title="{{ $title }}" webkitallowfullscreen mozallowfullscreen allowfullscreen> - </iframe> - </div> -</vimeo-video> |