diff options
Diffstat (limited to 'themes/default/layouts/partials')
74 files changed, 772 insertions, 642 deletions
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> |