diff options
author | tdro <tdro@noreply.example.com> | 2022-05-03 04:25:49 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-05-03 04:25:49 -0400 |
commit | e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6 (patch) | |
tree | 3667043819ab91065019dfe3b4ff83ad625c2b49 /themes | |
download | canory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.tar.gz canory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.tar.bz2 canory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.zip |
config.yaml: Commission
Diffstat (limited to 'themes')
94 files changed, 2250 insertions, 0 deletions
diff --git a/themes/default/layouts/_default/_markup/render-codeblock-goat.html b/themes/default/layouts/_default/_markup/render-codeblock-goat.html new file mode 100644 index 0000000..e83d7de --- /dev/null +++ b/themes/default/layouts/_default/_markup/render-codeblock-goat.html @@ -0,0 +1,19 @@ +{{ $width := .Attributes.width }} +{{ $height := .Attributes.height }} +{{ $caption := default "GoAT Diagram" .Attributes.caption }} + +<diagram-container> + {{ with diagrams.Goat .Inner }} + <svg + xmlns="http://www.w3.org/2000/svg" + {{ if or $width $height }} + {{ with $width }}width="{{ . }}"{{ end }} + {{ with $height }}height="{{ . }}"{{ end }} + {{ else }} + viewBox="0 0 {{ .Width }} {{ .Height }}" + {{ end }}> + {{ .Inner }} + </svg> + {{ end }} + <figcaption>{{ $caption | markdownify }}</figcaption> +</diagram-container> diff --git a/themes/default/layouts/_default/_markup/render-codeblock.html b/themes/default/layouts/_default/_markup/render-codeblock.html new file mode 100644 index 0000000..9dba950 --- /dev/null +++ b/themes/default/layouts/_default/_markup/render-codeblock.html @@ -0,0 +1,19 @@ +{{ $options := .Attributes.options | default "default=1" }} +{{ $caption := .Attributes.caption }} + +<code-block {{ if in (lower $options) "linenos" }}data-lines{{ end }}> + <header> + <language-label> + {{ .Type }} + </language-label> + <button> + {{ safeHTML (readFile "static/icons/feather/copy.svg") }} + <span>Copy</span> + </button> + </header> + {{ highlight .Inner .Type (print $options ",lineAnchors=" "code-" (truncate 7 "" (md5 .Inner))) }} +</code-block> + +{{ with $caption }} + <figcaption>{{ . | markdownify }}</figcaption> +{{ end }} diff --git a/themes/default/layouts/_default/_markup/render-heading.html b/themes/default/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..37eddb2 --- /dev/null +++ b/themes/default/layouts/_default/_markup/render-heading.html @@ -0,0 +1,6 @@ +<h{{ .Level }} id="{{ .Anchor | safeURL }}"> + <a + title="{{ .Text | safeHTML }}" + href="#{{ .Anchor | 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 new file mode 100644 index 0000000..00f37cf --- /dev/null +++ b/themes/default/layouts/_default/_markup/render-image.html @@ -0,0 +1,45 @@ +{{- $source := $.Destination | safeURL -}} +{{- $localPath := print "content/" $source -}} +{{- $remoteImage := resources.GetRemote $source -}} +{{- $width := "" -}} +{{- $height := "" -}} + +{{- with $remoteImage -}} + {{- with .Err -}} + {{- if fileExists $localPath -}} + {{- $localImage := imageConfig $localPath -}} + {{- with $localImage -}} + {{- $width = .Width -}} + {{- $height = .Height -}} + {{- end -}} + {{- else -}} + {{- $source = print "/images/404.png" -}} + {{- $localPath = print "static/" $source -}} + {{- $localImage := imageConfig $localPath -}} + {{- with $localImage -}} + {{- $width = .Width -}} + {{- $height = .Height -}} + {{- end -}} + {{- end -}} + {{- else -}} + {{- $width = .Width -}} + {{- $height = .Height -}} + {{ end }} +{{ end }} + +{{- /* This comment removes trailing newlines and white spaces. */ -}} +<figure> + <a href="{{ $source }}"> + <img loading="lazy" + src="{{ $source }}" + alt="{{ $.Text | htmlUnescape }}" + title="{{ $.Text | htmlUnescape }}" + width="{{ $width }}" + height="{{ $height }}" + /> + </a> +{{ if $.Title }} + <figcaption>{{ $.Title | markdownify }}</figcaption> +{{ end -}} +</figure> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/_default/_markup/render-link.html b/themes/default/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..9b1ffae --- /dev/null +++ b/themes/default/layouts/_default/_markup/render-link.html @@ -0,0 +1,21 @@ +{{- $link := .Destination -}} +{{ $isRemote := strings.HasPrefix $link "http" }} +{{- if not $isRemote -}} +{{ $url := urls.Parse .Destination }} +{{- if $url.Path -}} +{{ $fragment := "" }} +{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}} +{{- with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end }}{{ end -}} +{{- end -}} +<a + rel="noopener" + href="{{ $link | safeURL }}" + {{ with or .Title ($link | safeURL) -}} + title="{{ . }}" + {{ end }} + {{- if $isRemote -}} + target="_blank" + {{ end }}> + {{- .Text | safeHTML -}} +</a> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/_default/baseof.html b/themes/default/layouts/_default/baseof.html new file mode 100644 index 0000000..01b6ea0 --- /dev/null +++ b/themes/default/layouts/_default/baseof.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> + <head> + <title> + {{- block "title" . -}}{{- end -}} + {{- partial "site-title.html" . -}} + </title> + <meta name="description" content="{{- partial "site-description.html" . -}}"> + {{- partial "head.html" . -}} + {{- block "styles" . -}}{{- end -}} + </head> + <body> + <skip-link> + <a href="#main">Skip to main content</a> + </skip-link> + + <column-left> + {{- partial "navigator-left.html" . -}} + </column-left> + + <column-middle> + <main id="main"> + {{- block "middle" . -}}{{- end -}} + {{- partial "footer.html" . -}} + </main> + </column-middle> + + <column-right> + {{- block "right" . -}}{{- end -}} + </column-right> + </body> +</html> diff --git a/themes/default/layouts/_default/feeds.html b/themes/default/layouts/_default/feeds.html new file mode 100644 index 0000000..40442a1 --- /dev/null +++ b/themes/default/layouts/_default/feeds.html @@ -0,0 +1,151 @@ +{{ define "styles" }} +{{ $author := partial "author-user.html" . }} +<style> + {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + + tab-list a[href="/{{ $author }}/feeds/"] { + display: inherit; + font-weight: 700; + text-decoration: underline; + text-decoration-color: #014cc6; + text-decoration-color: var(--link); + } +</style> +{{ end }} + +{{ define "middle" }} + + {{ partial "navigator-middle.html" + (dict + "Title" "Feeds" + "Subtitle" (partial "count-media.html" .) + "Icon" "arrow-left" + "IconLabel" "Back" + "Href" "/" + "Id" "back" + "Context" . + ) + }} + + {{ partial "profile.html" . }} + + {{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}} + + {{ $feeds := slice }} + + {{ range $key, $value := (seq 3) }} + {{ range first 5 $author.webring.rss -}} + + {{ with resources.GetRemote . }} + {{- with .Err -}} + {{- warnf "%s" . -}} + {{- end -}} + {{ end }} + + {{ with resources.GetRemote . | transform.Unmarshal -}} + + {{- $title := "Example Domain" -}} + {{- $link := "https://example.com/link" -}} + {{- $description := "No description found." -}} + {{- $content := "No content found." -}} + {{- $sourceTitle := "From Example Domain" -}} + {{- $sourceLink := "https://example.com/" -}} + {{- $sourceDescription := "The example domain." -}} + {{- $date := now.Format "January 2, 2006" -}} + {{- $dateTime := now.Format "2006-01-02T15:04:05Z" -}} + {{- $dateTitle := now.Format "Monday, January 2 2006 at 15:04:05 MST" -}} + + {{ with .channel -}} + + {{ if reflect.IsMap (index .link 0) -}} + {{ $sourceLink = index (index .link 0) "-href" | plainify | htmlUnescape -}} + {{ else -}} + {{ $sourceLink = index .link 0 | plainify | htmlUnescape -}} + {{ end -}} + + {{ $sourceDescription = .description | plainify | htmlUnescape -}} + + {{ $sourceTitle = .title | plainify | htmlUnescape -}} + + {{ range first $value .item -}} + {{ $description = delimit (.description | plainify | htmlUnescape | findRE "^([^.]+)") " " -}} + {{ $content = .description | plainify | htmlUnescape -}} + {{ $title = .title | plainify | htmlUnescape -}} + {{ $link = .link | plainify | htmlUnescape -}} + {{ $date = .pubDate | plainify | htmlUnescape | time.Format "January 2, 2006" -}} + {{ $dateTime = .pubDate | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z" -}} + {{ $dateTitle = .pubDate | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}} + {{ end -}} + + {{ else -}} + + {{ $sourceLink = index (index .link 0) "-href" | plainify | htmlUnescape -}} + {{ $sourceTitle = .title | plainify | htmlUnescape -}} + {{ $sourceDescription = .subtitle | plainify | htmlUnescape -}} + + {{ range first $value .entry -}} + + {{ if reflect.IsMap .title -}} + {{ $title = index .title "#text" | plainify | htmlUnescape -}} + {{ else -}} + {{ $title = .title | plainify | htmlUnescape -}} + {{ end -}} + + {{ $date = .updated | plainify | htmlUnescape | time.Format "January 2, 2006" -}} + {{ $dateTime = .updated | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z" -}} + {{ $dateTitle = .updated | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}} + + {{ $link = .id -}} + {{ with .content -}} + {{ $description = delimit ((index . "#text") | plainify | htmlUnescape | findRE "^([^.]+)") " " -}} + {{ $content = (index . "#text") | plainify | htmlUnescape -}} + {{ end -}} + {{ with .summary -}} + {{ $description = delimit ((index . "#text") | plainify | htmlUnescape | findRE "^([^.]+)") " " -}} + {{ $content = (index . "#text") | plainify | htmlUnescape -}} + {{ end -}} + {{ end -}} + + {{ end -}} + + {{ + $feeds = $feeds | append (dict + "FeedTitle" $title + "FeedLink" $link + "FeedDescription" $description + "FeedContent" $content + "FeedSourceTitle" $sourceTitle + "FeedSourceLink" $sourceLink + "FeedSourceDescription" $sourceDescription + "FeedDate" $date + "FeedDateTime" $dateTime + "FeedDateTitle" $dateTitle + ) + }} + + {{ end }} + {{ end }} + {{ end }} + + {{ range sort $feeds "FeedDateTime" "desc" }} + {{ partial "card-feed.html" (dict + "FeedName" ((delimit (first 3 (split .FeedSourceTitle " ")) " ") | replaceRE "[^a-zA-Z ]" "") + "FeedSourceDomain" (.FeedSourceLink | replaceRE "^https?://([^/]+).*" "$1") + "FeedSourceLink" .FeedSourceLink + "FeedContent" (or .FeedDescription .FeedTitle) + "FeedDate" .FeedDate + "FeedDateTime" .FeedDateTime + "FeedDateTitle" .FeedDateTime + "FeedWordCount" ((or .FeedDescription .FeedTitle) | countwords) + "FeedLink" .FeedLink + ) + }} + {{ end }} + + {{ partial "pagination.html" . }} + +{{ end }} + +{{ define "right" }} + {{- partial "navigator-right.html" . -}} +{{ end }} diff --git a/themes/default/layouts/_default/home.archive-messages.html b/themes/default/layouts/_default/home.archive-messages.html new file mode 100644 index 0000000..cd0ba49 --- /dev/null +++ b/themes/default/layouts/_default/home.archive-messages.html @@ -0,0 +1,50 @@ +{{ 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" . + ) +}} + +<message-archive> + <item-list> + {{ $type := (partial "author-user.html" .) }} + {{ range (.Site.RegularPages.GroupByDate "2006") }} + {{ range (first 1 .Pages) }} + <h1>{{ .Date.Format "2006" }}</h1> + {{ end }} + <ul> + {{ range .Pages }} + {{ if (ne .Params.hidden true) }} + <li> + <a title="{{ partial "title.html" . }}" href="{{ .RelPermalink }}#{{ partial "card-id.html" . }}"> + <span>{{ .Date.Format "02 Jan" }}</span> + <span>{{ partial "title.html" . }}</span> + <span>@{{ partial "author-user.html" . }}</span> + </a> + </li> + {{ end }} + {{ end }} + </ul> + {{ end }} + </item-list> +</message-archive> +{{ end }} + +{{ define "right" }} + {{- partial "navigator-right-default.html" . -}} +{{ end }} diff --git a/themes/default/layouts/_default/home.archive-tags.html b/themes/default/layouts/_default/home.archive-tags.html new file mode 100644 index 0000000..cf26c40 --- /dev/null +++ b/themes/default/layouts/_default/home.archive-tags.html @@ -0,0 +1,47 @@ +{{ 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" . + ) +}} + +<item-list> + {{ range $taxonomy := .Site.Taxonomies }} + {{ range $tag, $article := $taxonomy }} + <h1><a href="/tags/{{ $tag }}/">#{{ $tag }}</a></h1> + <ul> + {{ range $article.Pages }} + <li> + <a + title="{{ partial "title.html" . }}" + href="/tags/{{ $tag }}/#{{ partial "card-id.html" . }}"> + <span>{{ .Date.Format "02 Jan 2006" }}</span> + <span>{{ partial "title.html" . }}</span> + <span>@{{ partial "author-user.html" . }}</span> + </a> + </li> + {{ end }} + </ul> + {{ end }} + {{ end }} +</item-list> +{{ end }} + +{{ define "right" }} + {{- partial "navigator-right-default.html" . -}} +{{ end }} diff --git a/themes/default/layouts/_default/home.authors.html b/themes/default/layouts/_default/home.authors.html new file mode 100644 index 0000000..af2a7c6 --- /dev/null +++ b/themes/default/layouts/_default/home.authors.html @@ -0,0 +1,40 @@ +{{ define "title" }}Authors — {{ end }} +{{ define "description" }}This page contains a list of all authors — {{ end }} +{{ define "styles" }} +<style> + {{ partial "styles-navigator.html" (dict "Link" "/authors/") | safeCSS }} +</style> +{{ end }} + +{{ define "middle" }} + + {{ partial "navigator-middle.html" + (dict + "Title" "Authors" + "Subtitle" (partial "count-authors.html" .) + "Icon" "arrow-left" + "IconLabel" "Back" + "Href" "/" + "Id" "back" + "Context" . + ) + }} + + {{ $authors := slice }} + + {{- range $index, $data := where .Site.RegularPages ".Params.hidden" "!=" "true" -}} + {{ $authors = $authors | append $data.Type }} + {{- end -}} + + {{ $authors = uniq $authors }} + + {{ range $author := $authors }} + {{ $data := index $.Site.Data.authors $author | default "default" }} + {{ partial "author-card.html" (dict "Data" $data) }} + {{ end }} + +{{ end }} + +{{ define "right" }} + {{- partial "navigator-right-default.html" . -}} +{{ end }} diff --git a/themes/default/layouts/_default/home.browserconfig.xml b/themes/default/layouts/_default/home.browserconfig.xml new file mode 100644 index 0000000..67bc7a3 --- /dev/null +++ b/themes/default/layouts/_default/home.browserconfig.xml @@ -0,0 +1,13 @@ +{{- $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.sources.html b/themes/default/layouts/_default/home.sources.html new file mode 100644 index 0000000..aa77e2a --- /dev/null +++ b/themes/default/layouts/_default/home.sources.html @@ -0,0 +1,120 @@ +{{ define "title" }}Sources — {{ end }} +{{ define "description" }}This page contains a list of all source files — {{ end }} +{{ define "styles" }} +<style> + {{ partial "styles-navigator.html" (dict "Link" "/sources/") | safeCSS }} +</style> +{{ 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") }} + + {{ $fileCount := add (len $shortcodes) (len $partials) }} + + {{ partial "navigator-middle.html" + (dict + "Title" "Sources" + "Subtitle" (print $fileCount " " "Files") + "Icon" "arrow-left" + "IconLabel" "Back" + "Href" "/" + "Id" "back" + "Context" . + ) + }} + + <source-array> + <item-list> + + <h1>Defaults</h1> + <ul> + {{ range sort $_default ".ModTime" "desc" }} + {{ if not .IsDir }} + <li> + <a download title="{{ .Name }}" href="/source/files/_default/{{ .Name }}"> + <code> + <span>{{- .ModTime | time.Format "2006-01-02 15:04 MST" }}</span> + <span>{{ .Name }}</span> + <span>{{ .Size -}}</span> + </code> + </a> + </li> + {{ end }} + {{ end }} + </ul> + + <h1>Markup</h1> + <ul> + {{ range sort $_markup ".ModTime" "desc" }} + {{ if not .IsDir }} + <li> + <a download title="{{ .Name }}" href="/source/files/_default/_markup/{{ .Name }}"> + <code> + <span>{{- .ModTime | time.Format "2006-01-02 15:04 MST" }}</span> + <span>{{ .Name }}</span> + <span>{{ .Size -}}</span> + </code> + </a> + </li> + {{ end }} + {{ end }} + </ul> + + <h1>Partials</h1> + <ul> + {{ range sort $partials ".ModTime" "desc" }} + {{ if not .IsDir }} + <li> + <a download title="{{ .Name }}" href="/source/files/partials/{{ .Name }}"> + <code> + <span>{{- .ModTime | time.Format "2006-01-02 15:04 MST" }}</span> + <span>{{ .Name }}</span> + <span>{{ .Size -}}</span> + </code> + </a> + </li> + {{ end }} + {{ end }} + </ul> + + <h1>Shortcodes</h1> + <ul> + {{ range sort $shortcodes ".ModTime" "desc" }} + {{ if not .IsDir }} + <li> + <a download title="{{ .Name }}" href="/source/files/shortcodes/{{ .Name }}"> + <code> + <span>{{- .ModTime | time.Format "2006-01-02 15:04 MST" }}</span> + <span>{{ .Name }}</span> + <span>{{ .Size -}}</span> + </code> + </a> + </li> + {{ end }} + {{ end }} + </ul> + </item-list> + + <footer> + <p> + Canory Version: 0.1.1 + · 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">License</a> + · Fuzzy Sort by Stephen Kamenar: <a href="https://github.com/farzher/fuzzysort/blob/e7f484a124f09bf3cb9a4db366a95457d962dbed/LICENSE">MIT License</a> + </p> + </footer> + + </source-array> + +{{ end }} + +{{ define "right" }} + {{- partial "navigator-right-default.html" . -}} +{{ end }} diff --git a/themes/default/layouts/_default/index.json b/themes/default/layouts/_default/index.json new file mode 100644 index 0000000..9096730 --- /dev/null +++ b/themes/default/layouts/_default/index.json @@ -0,0 +1,40 @@ +{ + "version": "https://jsonfeed.org/version/1.1", + "title": "{{ .Site.Title }}", + "home_page_url": "{{ .Site.BaseURL }}", + "feed_url": "{{ .Site.BaseURL }}/index.json", + "items": [ + {{- range $index, $data := where .Site.RegularPages ".Params.hidden" "!=" "true" -}} + {{- if and (ne $data.Type "json") (not .ExpiryDate) -}} + {{- if and $index (gt $index 0) -}},{{- end }} + { + "id": "{{ md5 $data.Permalink }}", + "url": "{{ $data.Permalink }}", + "title": "{{ htmlEscape $data.Summary }}", + "summary": "{{ $data.Summary }}", + "date_modified": "{{ $data.Date | time.Format "2006-01-02T15:04:05Z" }}", + "date_published": "{{ $data.PublishDate | time.Format "2006-01-02T15:04:05Z" }}", + "_metadata": { + "slug": "{{ $data.Slug }}", + "type": "{{ $data.Type }}" + }, + "author": { + "name": "{{ partial "author-user.html" . }}" + }, + "tags": [ + {{- range $tags, $tag := $data.Params.tags -}} + {{- if $tags -}} + , + {{- end -}} + " + {{- $tag | htmlEscape -}} + " + {{- end -}} + ], + "content_text": {{ $data.Plain | jsonify }}, + "content_html": {{ $data.Content | jsonify }} + } + {{- end -}} + {{ end }} + ] +} diff --git a/themes/default/layouts/_default/index.webmanifest b/themes/default/layouts/_default/index.webmanifest new file mode 100644 index 0000000..f7b3f66 --- /dev/null +++ b/themes/default/layouts/_default/index.webmanifest @@ -0,0 +1,24 @@ +{{- $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/likes.html b/themes/default/layouts/_default/likes.html new file mode 100644 index 0000000..b3be32c --- /dev/null +++ b/themes/default/layouts/_default/likes.html @@ -0,0 +1,58 @@ +{{ define "styles" }} +{{ $author := partial "author-user.html" . }} +<style> + {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + + tab-list a[href="/{{ $author }}/likes/"] { + display: inherit; + font-weight: 700; + text-decoration: underline; + text-decoration-color: #014cc6; + text-decoration-color: var(--link); + } +</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 "author-user.html" . }} + {{ $count := 0 }} + {{ $result := false }} + + {{ range .Site.Pages }} + {{ if and (eq .Type $author) .Params.Liked }} + {{ $result = true }} + {{ $count = add $count 1 }} + {{ if le $count 10 }} + {{ .Render "summary" }} + {{ end }} + {{ end }} + {{ end }} + + {{ if not $result }} + <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/list.html b/themes/default/layouts/_default/list.html new file mode 100644 index 0000000..f35f275 --- /dev/null +++ b/themes/default/layouts/_default/list.html @@ -0,0 +1,29 @@ +{{ define "styles" }} +<style> + {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} +</style> +{{ end }} + +{{ define "middle" }} + + {{ partial "navigator-middle.html" + (dict + "Title" "Home" + "Subtitle" (partial "count-total-messages.html" .) + "Context" . + ) + }} + + {{ range where .Paginator.Pages ".Params.hidden" "ne" "true" }} + {{ .Render "summary" }} + {{ end }} + + {{ partial "pagination.html" . }} + +{{ end }} + +{{ define "right" }} + {{ range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.webring) }} + {{- partial "navigator-right.html" . -}} + {{ end }} +{{ end }} diff --git a/themes/default/layouts/_default/media.html b/themes/default/layouts/_default/media.html new file mode 100644 index 0000000..8073928 --- /dev/null +++ b/themes/default/layouts/_default/media.html @@ -0,0 +1,40 @@ +{{ define "styles" }} +{{ $author := partial "author-user.html" . }} +<style> + {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + + tab-list a[href="/{{ $author }}/media/"] { + display: inherit; + font-weight: 700; + text-decoration: underline; + text-decoration-color: #014cc6; + text-decoration-color: var(--link); + } +</style> +{{ end }} + +{{ define "middle" }} + + {{ partial "navigator-middle.html" + (dict + "Title" "Media" + "Subtitle" (partial "count-media.html" .) + "Icon" "arrow-left" + "IconLabel" "Back" + "Href" "/" + "Id" "back" + "Context" . + ) + }} + + {{ partial "profile.html" . }} + + {{ partial "media-search.html" . }} + + {{ partial "pagination.html" . }} + +{{ end }} + +{{ define "right" }} + {{- partial "navigator-right.html" . -}} +{{ end }} diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml new file mode 100644 index 0000000..4570a98 --- /dev/null +++ b/themes/default/layouts/_default/rss.xml @@ -0,0 +1,32 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := $pctx.RegularPages -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ partial "site-title" . }}</title> + <link>{{ .Permalink }}</link> + <description>Recent from {{ partial "site-title" . }}</description> + <language>{{ .Site.LanguageCode }}</language> + {{- if not .Date.IsZero -}} + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} + {{ with .OutputFormats.Get "RSS" }} + {{- printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink "application/rss+xml" | safeHTML -}} + {{ end }} + {{- range $pages -}} + {{ if and (ne .Params.hidden true) (not .Params.Unlisted) (not .ExpiryDate) }} + <item> + <title>{{ htmlEscape .Summary }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + <guid>{{ .Permalink }}</guid> + <description>{{ .Content | html }}</description> + </item> + {{ end }} + {{ end }} + </channel> +</rss> diff --git a/themes/default/layouts/_default/section.html b/themes/default/layouts/_default/section.html new file mode 100644 index 0000000..e0b607c --- /dev/null +++ b/themes/default/layouts/_default/section.html @@ -0,0 +1,45 @@ +{{ define "styles" }} +<style> + {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} + + tab-list a[href="/{{ partial "author-user.html" . }}"] { + display: inherit; + font-weight: 700; + text-decoration: underline; + text-decoration-color: #014cc6; + text-decoration-color: var(--link); + } +</style> +{{ end }} + +{{ define "middle" }} + + {{- $messages := print (lang.FormatNumberCustom 0 .Paginator.TotalNumberOfElements) " " "Messages" -}} + + {{ partial "navigator-middle.html" + (dict + "Title" (partial "author-name.html" .) + "Subtitle" $messages + "Icon" "arrow-left" + "IconLabel" "Back" + "Href" "/" + "Id" "back" + "Context" . + ) + }} + + {{ partial "profile.html" . }} + + {{ range where .Paginator.Pages ".Params.hidden" "ne" "true" }} + {{ .Render "summary" }} + {{ end }} + + {{ partial "pagination.html" . }} + +{{ end }} + +{{ define "right" }} + {{ range first 1 .Paginator.Pages }} + {{- partial "navigator-right.html" . -}} + {{ end }} +{{ end }} diff --git a/themes/default/layouts/_default/single.html b/themes/default/layouts/_default/single.html new file mode 100644 index 0000000..4858f0a --- /dev/null +++ b/themes/default/layouts/_default/single.html @@ -0,0 +1,22 @@ +{{ define "middle" }} + +{{ partial "navigator-middle.html" + (dict + "Title" "Message" + "Subtitle" "Single" + "Icon" "arrow-left" + "IconLabel" "Back" + "Href" "/" + "Id" "back" + "Context" . + ) +}} + +<micro-thread> + {{ partial "card.html" . }} +</micro-thread> +{{ end }} + +{{ define "right" }} + {{- partial "navigator-right.html" . -}} +{{ end }} diff --git a/themes/default/layouts/_default/sitemap.xml b/themes/default/layouts/_default/sitemap.xml new file mode 100644 index 0000000..63f5119 --- /dev/null +++ b/themes/default/layouts/_default/sitemap.xml @@ -0,0 +1,22 @@ +{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" + xmlns:xhtml="http://www.w3.org/1999/xhtml"> + {{ range .Data.Pages }} + <url> + <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} + <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }} + <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }} + <priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }} + <xhtml:link + rel="alternate" + hreflang="{{ .Language.Lang }}" + href="{{ .Permalink }}" + />{{ end }} + <xhtml:link + rel="alternate" + hreflang="{{ .Language.Lang }}" + href="{{ .Permalink }}" + />{{ end }} + </url> + {{ end }} +</urlset> diff --git a/themes/default/layouts/_default/summary.html b/themes/default/layouts/_default/summary.html new file mode 100644 index 0000000..3b6a0b3 --- /dev/null +++ b/themes/default/layouts/_default/summary.html @@ -0,0 +1 @@ +{{ partial "card.html" . }} diff --git a/themes/default/layouts/_default/taxonomy.html b/themes/default/layouts/_default/taxonomy.html new file mode 100644 index 0000000..e43bc29 --- /dev/null +++ b/themes/default/layouts/_default/taxonomy.html @@ -0,0 +1,62 @@ +{{ define "styles" }} +<style> + {{ partial "styles-navigator.html" (dict "Link" "/tags/") | safeCSS }} +</style> +{{ end }} + +{{ define "middle" }} + + {{ $title := .Title }} + + {{ if eq .Title "Tags" }} + + {{ partial "navigator-middle.html" + (dict + "Title" "Tags" + "Subtitle" (partial "count-tags.html" .) + "Icon" "arrow-left" + "IconLabel" "Back" + "Href" "/" + "Id" "back" + "Context" . + ) + }} + + {{ $page := 1 }} + {{ $count := 0 }} + + {{ range .Paginator.Pages }} + {{ $title := lower .Title }} + <item-list> + <h1><a href="/tags/{{ $title }}">#{{ .Title }}</a></h1> + <ul> + {{ range .Pages }} + {{ $count = add $count 1 }} + <li> + <a + title="{{ partial "title.html" . }}" + href="/tags/{{ $title }}/{{ if gt $page 1 }}page/{{ $page }}/{{ end }}#{{ partial "card-id.html" . }}"> + <span>{{ .Date.Format "02 Jan 2006" }}</span> + <span>{{ partial "title.html" . }}</span> + <span>@{{ partial "author-user.html" . }}</span> + </a> + </li> + {{ if eq (mod $count $.Paginator.PageSize) 0 }} + {{ $page = add $page 1 }} + {{ end }} + {{ end }} + {{ $page = 1 }} + {{ $count = 0 }} + </ul> + </item-list> + {{ end }} + + {{ partial "pagination.html" . }} + + {{ end }} + +{{ end }} + +{{ define "right" }} + {{- partial "navigator-right-default.html" . -}} +{{ end }} diff --git a/themes/default/layouts/_default/term.html b/themes/default/layouts/_default/term.html new file mode 100644 index 0000000..30776ff --- /dev/null +++ b/themes/default/layouts/_default/term.html @@ -0,0 +1,33 @@ +{{ define "styles" }} +<style> + {{ partial "styles-navigator.html" (dict "Link" "/tags/") | safeCSS }} +</style> +{{ end }} + +{{ define "middle" }} + + {{- $terms := print (lang.FormatNumberCustom 0 (len .Data.Pages)) " " "Messages" -}} + + {{ partial "navigator-middle.html" + (dict + "Title" (print "#" .Title) + "Subtitle" $terms + "Icon" "arrow-left" + "IconLabel" "Back" + "Href" "/" + "Id" "back" + "Context" . + ) + }} + + {{ range .Paginator.Pages }} + {{ partial "card.html" . }} + {{ end }} + + {{ partial "pagination.html" . }} + +{{ end }} + +{{ define "right" }} + {{- partial "navigator-right-default.html" . -}} +{{ end }} diff --git a/themes/default/layouts/partials/archive-link.html b/themes/default/layouts/partials/archive-link.html new file mode 100644 index 0000000..8b08ba3 --- /dev/null +++ b/themes/default/layouts/partials/archive-link.html @@ -0,0 +1,2 @@ +/archives/{{ .Type }}/ +{{- /* Strip newline. */ -}} diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html new file mode 100644 index 0000000..bbb79b0 --- /dev/null +++ b/themes/default/layouts/partials/author-card.html @@ -0,0 +1,23 @@ +<micro-author> + <micro-card> + <micro-summary> + <micro-thumbnail> + <figure> + <a title="{{ .Data.name }}" href="/{{ .Data.user }}#"> + <picture> + <img alt="{{ .Data.name }}" src="/{{ .Data.user }}/media/profile/picture.png" /> + </picture> + </a> + </figure> + </micro-thumbnail> + <micro-header> + <h1>{{ .Data.name }}</h1> + <h2><a title="" href="/{{ .Data.user }}">@{{ .Data.user }}</a></h2> + </micro-header> + <a title="RSS" href="/{{ .Data.user }}/rss.xml"> + {{ safeHTML (readFile "static/icons/feather/rss.svg") }} + <span>Follow</span> + </a> + </micro-summary> + </micro-card> +</micro-author> diff --git a/themes/default/layouts/partials/author-domain-host.html b/themes/default/layouts/partials/author-domain-host.html new file mode 100644 index 0000000..5f6b7f0 --- /dev/null +++ b/themes/default/layouts/partials/author-domain-host.html @@ -0,0 +1,2 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} +{{- $author.domain.host | markdownify -}} diff --git a/themes/default/layouts/partials/author-list.html b/themes/default/layouts/partials/author-list.html new file mode 100644 index 0000000..759fa44 --- /dev/null +++ b/themes/default/layouts/partials/author-list.html @@ -0,0 +1,17 @@ +<author-list> + {{ $authors := slice }} + + {{- range $index, $data := where .Site.RegularPages ".Params.hidden" "!=" "true" -}} + {{ $authors = $authors | append $data.Type }} + {{- end -}} + + {{ $authors = uniq $authors }} + + <h1>Authors</h1> + <section> + {{ range $author := first 5 $authors }} + {{ $data := index $.Site.Data.authors $author | default "default" }} + {{ partial "author-card.html" (dict "Data" $data) }} + {{ end }} + </section> +</author-list> diff --git a/themes/default/layouts/partials/author-media-path.html b/themes/default/layouts/partials/author-media-path.html new file mode 100644 index 0000000..77090ea --- /dev/null +++ b/themes/default/layouts/partials/author-media-path.html @@ -0,0 +1,2 @@ +{{ partial "author-user.html" . }}/media +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/author-name.html b/themes/default/layouts/partials/author-name.html new file mode 100644 index 0000000..405569c --- /dev/null +++ b/themes/default/layouts/partials/author-name.html @@ -0,0 +1,2 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} +{{- $author.name | markdownify -}} diff --git a/themes/default/layouts/partials/author-user.html b/themes/default/layouts/partials/author-user.html new file mode 100644 index 0000000..8d7036a --- /dev/null +++ b/themes/default/layouts/partials/author-user.html @@ -0,0 +1,2 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} +{{- $author.user | markdownify -}} diff --git a/themes/default/layouts/partials/card-feed.html b/themes/default/layouts/partials/card-feed.html new file mode 100644 index 0000000..fbcab8c --- /dev/null +++ b/themes/default/layouts/partials/card-feed.html @@ -0,0 +1,82 @@ +<micro-card> + <micro-summary> + <micro-thumbnail> + + {{- $imageCanonicalURL := (print "https://" .FeedSourceDomain "/favicon.ico") -}} + {{- $imageTitle := "No image found" -}} + {{- $imageSource := "/images/404.png" -}} + + {{- with $image := resources.GetRemote $imageCanonicalURL -}} + {{- with .Err -}} + {{ warnf "%s" . }} + {{- $fallbackImage := imageConfig (print "static/images/404.png") -}} + {{- with $fallbackImage -}} + {{- $fallbackWidth := .Width -}} + {{- $fallbackHeight := .Height -}} + {{ end }} + {{- else -}} + {{- $imageTitle = $imageCanonicalURL -}} + {{- $imageSource = $image.RelPermalink -}} + {{ end }} + <figure> + <a title="{{ $imageTitle }}" href=" {{ $imageSource }}"> + <picture> + <img alt="" src="{{ $imageSource }}" /> + </picture> + </a> + </figure> + {{ else }} + <figure> + <a title="{{ $imageTitle }}" href=" {{ $imageSource }}"> + <picture> + <img alt="" src="{{ $imageSource }}" /> + </picture> + </a> + </figure> + {{ end }} + + </micro-thumbnail> + + <micro-content> + <micro-metadata> + <micro-thumbnail hidden> + <figure> + <a title="{{ $imageTitle }}" href=" {{ $imageSource }}"> + <picture> + <img alt="" src="{{ $imageSource }}" /> + </picture> + </a> + </figure> + </micro-thumbnail> + <section> + <b>{{ .FeedName }}</b> + + · <a + title="{{ .FeedSourceLink }}" + rel="noopener" + target="_blank" + href="{{ .FeedSourceLink }}"> + @{{ .FeedSourceDomain }} + </a> + + · <a href="{{ .FeedLink }}"> + <time + datetime="{{ .FeedDateTime }}" + title="{{ .FeedDateTime | time.Format "Monday, January 2 2006 at 15:04:05 MST" }}"> + {{ .FeedDate }} + </time> + </a> + + · {{- partial "read-time.html" (dict "WordCount" .FeedWordCount) -}} + + · <word-limit> + <word-count title="{{ .FeedWordCount }} words"> + {{ .FeedWordCount }} words + </word-count> + </word-limit> + </section> + </micro-metadata> + <p>{{ .FeedContent }}.</p> + </micro-content> + </micro-summary> +</micro-card> diff --git a/themes/default/layouts/partials/card-id.html b/themes/default/layouts/partials/card-id.html new file mode 100644 index 0000000..b882d8b --- /dev/null +++ b/themes/default/layouts/partials/card-id.html @@ -0,0 +1,7 @@ +{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}} +{{- $source := print $author.user "/messages/" .File.LogicalName -}} +{{- $source = replace $source "/" "-" -}} +{{ if .ExpiryDate }} + {{- $source = md5 $source -}} +{{ end }} +{{- $source -}} diff --git a/themes/default/layouts/partials/card.html b/themes/default/layouts/partials/card.html new file mode 100644 index 0000000..ef4fe11 --- /dev/null +++ b/themes/default/layouts/partials/card.html @@ -0,0 +1,35 @@ +<micro-card {{ if .Weight }}pinned{{ end }} id="{{ partial "card-id.html" . }}"> + {{ if .ExpiryDate }}<micro-expires>{{ end }} + <micro-summary title="{{- partial "title.html" . -}}"> + <micro-thumbnail> + {{ partial "profile-picture.html" . }} + </micro-thumbnail> + <micro-content> + <micro-metadata> + {{ partial "meta.html" . }} + </micro-metadata> + {{ if .Params.nsfw }} + <micro-nsfw> + <details> + <summary> + {{ safeHTML (readFile "static/icons/feather/alert-circle.svg") }} + <span>Danger: Unsafe Content. <b><u>Click here</u></b> to show/hide</span> + </summary> + </details> + <micro-nsfw-content> + {{ end }} + {{- + .Content | + replaceRE "<p>\n<figure>" "<figure>" | + replaceRE "</figure></p>" "</figure>" | + safeHTML + -}} + {{ if .Params.nsfw }} + </micro-nsfw-content> + </micro-nsfw> + {{ end }} + <micro-tags>{{ partial "tags.html" . }}</micro-tags> + </micro-content> + </micro-summary> + {{ if .ExpiryDate }}</micro-expires>{{ end }} +</micro-card> diff --git a/themes/default/layouts/partials/context-menu.html b/themes/default/layouts/partials/context-menu.html new file mode 100644 index 0000000..40e0001 --- /dev/null +++ b/themes/default/layouts/partials/context-menu.html @@ -0,0 +1,4 @@ +<input type="checkbox" id="context-menu-{{ .Name }}" /> +<label for="context-menu-{{ .Name }}">{{ .Label }}</label> + +<context-menu>{{ .Content }}</context-menu> diff --git a/themes/default/layouts/partials/context-profile.html b/themes/default/layouts/partials/context-profile.html new file mode 100644 index 0000000..91446a9 --- /dev/null +++ b/themes/default/layouts/partials/context-profile.html @@ -0,0 +1,22 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} + +<context-profile> + <context-menu> + <section> + <aside> + <figure> + <a title="{{ $author.name }}" href="/{{ $author.user }}"> + <picture> + <img alt="{{ $author.name }}" src="/{{ $author.user }}/media/profile/picture.png" /> + </picture> + </a> + </figure> + </aside> + <aside> + <h1>{{ $author.name }}</h1> + <h2>@{{ $author.user }}</h2> + </aside> + </section> + <p>{{- $author.description | markdownify -}}</p> + </context-menu> +</context-profile> diff --git a/themes/default/layouts/partials/count-authors.html b/themes/default/layouts/partials/count-authors.html new file mode 100644 index 0000000..7a39329 --- /dev/null +++ b/themes/default/layouts/partials/count-authors.html @@ -0,0 +1,6 @@ +{{ $authors := slice }} +{{- range $index, $data := where .Site.RegularPages ".Params.hidden" "!=" "true" -}} + {{ $authors = $authors | append $data.Type }} +{{- end -}} + +{{ print (lang.FormatNumberCustom 0 (len (uniq $authors))) " " "Authors" }} diff --git a/themes/default/layouts/partials/count-likes.html b/themes/default/layouts/partials/count-likes.html new file mode 100644 index 0000000..a808576 --- /dev/null +++ b/themes/default/layouts/partials/count-likes.html @@ -0,0 +1,10 @@ +{{ $author := partial "author-user.html" . }} +{{ $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-media.html b/themes/default/layouts/partials/count-media.html new file mode 100644 index 0000000..1d5e49b --- /dev/null +++ b/themes/default/layouts/partials/count-media.html @@ -0,0 +1,17 @@ +{{ $author := partial "author-user.html" . }} +{{ $count := 0 }} + +{{ 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" }} diff --git a/themes/default/layouts/partials/count-tags.html b/themes/default/layouts/partials/count-tags.html new file mode 100644 index 0000000..0ef6802 --- /dev/null +++ b/themes/default/layouts/partials/count-tags.html @@ -0,0 +1 @@ +{{- print (lang.FormatNumberCustom 0 (len .Site.Taxonomies.tags)) " " "Tags" -}} diff --git a/themes/default/layouts/partials/count-total-messages.html b/themes/default/layouts/partials/count-total-messages.html new file mode 100644 index 0000000..10540a7 --- /dev/null +++ b/themes/default/layouts/partials/count-total-messages.html @@ -0,0 +1,2 @@ +{{ $messages := len .Site.RegularPages }} +{{ print (lang.FormatNumberCustom 0 $messages) " " "Messages" }} diff --git a/themes/default/layouts/partials/csp.html b/themes/default/layouts/partials/csp.html new file mode 100644 index 0000000..9cba948 --- /dev/null +++ b/themes/default/layouts/partials/csp.html @@ -0,0 +1,40 @@ +{{ $upgrade := "" }} + +{{ if .Site.Params.production }} + {{ $upgrade = "upgrade-insecure-requests" }} +{{ end }} + +<meta name="referrer" content="{{ .Site.Params.csp.referrer }}"> + +{{ printf ` +<meta + http-equiv="Content-Security-Policy" + content=" + %s + block-all-mixed-content; + default-src 'self'; + child-src %s; + font-src %s; + form-action %s; + frame-src %s; + img-src %s; + media-src %s; + object-src %s; + prefetch-src %s; + script-src %s; + script-src-elem %s; + style-src %s; + ">` + ($upgrade) + (delimit .Site.Params.csp.childsrc " ") + (delimit .Site.Params.csp.fontsrc " ") + (delimit .Site.Params.csp.formaction " ") + (delimit .Site.Params.csp.framesrc " ") + (delimit .Site.Params.csp.imgsrc " ") + (delimit .Site.Params.csp.mediasrc " ") + (delimit .Site.Params.csp.objectsrc " ") + (delimit .Site.Params.csp.prefetchsrc " ") + (delimit .Site.Params.csp.scriptsrc " ") + (delimit .Site.Params.csp.scriptsrcelem " ") + (delimit .Site.Params.csp.stylesrc " ") + | safeHTML }} diff --git a/themes/default/layouts/partials/draft.html b/themes/default/layouts/partials/draft.html new file mode 100644 index 0000000..1760044 --- /dev/null +++ b/themes/default/layouts/partials/draft.html @@ -0,0 +1 @@ +{{ if .Draft }}<mark>·<strong>DRAFT</strong></mark>{{ end }} diff --git a/themes/default/layouts/partials/expiry-date.html b/themes/default/layouts/partials/expiry-date.html new file mode 100644 index 0000000..bf111f9 --- /dev/null +++ b/themes/default/layouts/partials/expiry-date.html @@ -0,0 +1,11 @@ +{{ $diff := now.Sub .ExpiryDate }} +{{ $duration := lang.FormatNumberCustom 0 (math.Round (mul (div $diff.Hours 24) -1)) }} + +<expiry-date> + <time + datetime= "{{ .ExpiryDate | time.Format "2006-01-02T15:04:05Z" }}" + title="Self destructs within {{ $duration }} days ({{ .ExpiryDate | time.Format "Monday, January 2 2006 at 15:04:05 MST" }})"> + {{ safeHTML (readFile "static/icons/feather/trash-2.svg") }} + {{ .ExpiryDate | time.Format "Jan 2 2006" }} + </time> +</expiry-date> diff --git a/themes/default/layouts/partials/footer.html b/themes/default/layouts/partials/footer.html new file mode 100644 index 0000000..5fe4295 --- /dev/null +++ b/themes/default/layouts/partials/footer.html @@ -0,0 +1,12 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} + +<footer> + {{- with .Site.Author.footer -}} + {{ if $.IsHome -}} + {{ . | markdownify }} + {{- else -}} + {{ $author.blogtitle }} + {{- end -}} + {{- end }} + | Copyright © {{ now.Format "2006"}} +</footer> diff --git a/themes/default/layouts/partials/gallery-images.html b/themes/default/layouts/partials/gallery-images.html new file mode 100644 index 0000000..1dfe611 --- /dev/null +++ b/themes/default/layouts/partials/gallery-images.html @@ -0,0 +1,8 @@ +{{ $folder := print "/content/" (partial "author-user.html" .) "/media/" }} + + <gallery-images> + <h1>Picture Gallary</h1> + <section> + {{ partial "gallery-walk.html" $folder }} + </section> + </gallery-images> diff --git a/themes/default/layouts/partials/gallery-walk.html b/themes/default/layouts/partials/gallery-walk.html new file mode 100644 index 0000000..daa27ac --- /dev/null +++ b/themes/default/layouts/partials/gallery-walk.html @@ -0,0 +1,41 @@ +{{- $folder := . }} + +{{- if fileExists $folder }} + {{- $files := readDir $folder }} + {{- if $files }} + {{- range $files }} + + {{- if not .IsDir }} + {{- $name := index (split .Name ".") 0 }} + {{- $extension := lower (index (split .Name ".") 1) }} + + {{- if or + (eq $extension "apng") + (eq $extension "avif") + (eq $extension "gif") + (eq $extension "jfif") + (eq $extension "jpeg") + (eq $extension "jpg") + (eq $extension "pjp") + (eq $extension "pjpeg") + (eq $extension "png") + (eq $extension "svg") + (eq $extension "webp") + }} + + <img + title="{{- .Name }}" + alt="{{- .Name }}" + src="/{{- strings.TrimPrefix "content/" (trim $folder "/") }}/{{- .Name }}" + /> + + {{- end }} + {{- end }} + + {{- if .IsDir }} + {{- partial "gallery-walk.html" (path.Join $folder .Name) }} + {{- end }} + + {{- end }} + {{- end }} +{{- end }} diff --git a/themes/default/layouts/partials/handle.html b/themes/default/layouts/partials/handle.html new file mode 100644 index 0000000..dcfb335 --- /dev/null +++ b/themes/default/layouts/partials/handle.html @@ -0,0 +1,5 @@ +<a + title="{{ partial "author-user.html" . }}@{{ partial "author-domain-host.html" . }}" + href="/{{ partial "author-user.html" . }}"> + @{{ partial "author-user.html" . }} +</a> diff --git a/themes/default/layouts/partials/head.html b/themes/default/layouts/partials/head.html new file mode 100644 index 0000000..856fb2f --- /dev/null +++ b/themes/default/layouts/partials/head.html @@ -0,0 +1,50 @@ +<!-- HTML Meta Tags --> +<meta charset="utf-8"> +<meta name="author" content="{{ partial "author-name.html" . -}}"> +{{ if or .Params.Unlisted .Params.ExpiryDate -}} +<meta name="robots" content="noindex,nofollow"> +{{- else -}} +<meta name="robots" content="index,follow"> +{{- end }} +<meta name="viewport" content="width=device-width, initial-scale=1"> +<meta name="keywords" content="{{- partial "site-title.html" . -}}"> + +<!-- Search Engine Tags --> +<meta itemprop="name" content="{{ partial "site-title.html" . -}}"> +<meta itemprop="description" content="{{ if .Params.summary }}{{ .Params.summary }}{{ else }}{{ .Summary }}{{ end }}"> +<meta itemprop="image" content="{{ .Site.BaseURL }}/images/{{ partial "meta-thumbnail-path.html" . }}.png"> + +<!-- Open Graph Meta Tags --> +<meta property="og:title" content="{{ partial "site-title.html" . -}}"> +<meta property="og:description" content="{{- partial "site-description.html" . -}}"> +<meta property="og:url" content="{{ .Permalink }}"> +<meta property="og:image" content="{{ .Site.BaseURL }}/images/{{ partial "meta-thumbnail-path.html" . }}.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 "site-title.html" . -}}"> +<meta name="twitter:description" content="{{- partial "site-description.html" . -}}"> +<meta name="twitter:image" content="{{ .Site.BaseURL }}/images/{{ partial "meta-thumbnail-path.html" . }}.png"> + +<!-- Progressive Enhancement --> +{{- partial "manifest.html" . -}} + +<!-- Content Security Policy --> +{{- partial "csp.html" . -}} + +<!-- Style Sheets --> +<link rel="stylesheet" href="/css/default.css"> +<link rel="stylesheet" href="/css/syntax-highlight-default.css"> + +<!-- Scripts --> +<script src="/js/index.js"></script> + +<!-- No Scripts --> +<noscript> + <style> + {{ safeCSS (readFile "static/css/noscript.css") }} + </style> +</noscript> diff --git a/themes/default/layouts/partials/js-back.html b/themes/default/layouts/partials/js-back.html new file mode 100644 index 0000000..afa40f7 --- /dev/null +++ b/themes/default/layouts/partials/js-back.html @@ -0,0 +1,2 @@ +history.go(-1); return false; +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/partials/manifest.html b/themes/default/layouts/partials/manifest.html new file mode 100644 index 0000000..4bd935a --- /dev/null +++ b/themes/default/layouts/partials/manifest.html @@ -0,0 +1,16 @@ +{{- $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" href="{{ $ico.RelPermalink | relURL }}"> +<link rel="icon" type="image/png" sizes="16x16" href="{{ $icon16.RelPermalink | relURL }}"> +<link rel="icon" type="image/png" sizes="32x32" href="{{ $icon32.RelPermalink | relURL }}"> +<link rel="apple-touch-icon" sizes="180x180" href="{{ $appleTouchIcon.RelPermalink | relURL }}"> +<link rel="manifest" href="/site.webmanifest"> +<meta name="msapplication-TileColor" content="#da532c"> +<meta name="theme-color" content="#ffffff"> + diff --git a/themes/default/layouts/partials/media-search.html b/themes/default/layouts/partials/media-search.html new file mode 100644 index 0000000..5954d16 --- /dev/null +++ b/themes/default/layouts/partials/media-search.html @@ -0,0 +1,27 @@ +{{ $author := partial "author-user.html" . }} + +{{ $count := 0 }} +{{ $result := false }} + +{{ range .Site.Pages }} + {{ 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 }} + +{{ if not $result }} +<footer> + <code>No media found!</code> +</footer> +{{ end }} diff --git a/themes/default/layouts/partials/meta-thumbnail-path.html b/themes/default/layouts/partials/meta-thumbnail-path.html new file mode 100644 index 0000000..90aa4c2 --- /dev/null +++ b/themes/default/layouts/partials/meta-thumbnail-path.html @@ -0,0 +1 @@ +{{- or .Slug "404" -}} diff --git a/themes/default/layouts/partials/meta.html b/themes/default/layouts/partials/meta.html new file mode 100644 index 0000000..6e10754 --- /dev/null +++ b/themes/default/layouts/partials/meta.html @@ -0,0 +1,64 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} +{{ $source := print $author.user "/messages/" .File.LogicalName }} + +<micro-thumbnail hidden> + {{ partial "profile-picture.html" . }} +</micro-thumbnail> + +<section> + {{ if or .Weight .Params.Liked }} + <anchored-entry> + + {{ if .Weight }} + <anchored-pinned> + {{ safeHTML (readFile "static/icons/tabler/pinned.svg") }} + </anchored-pinned> + <span>Pinned</span> + {{ end }} + + {{ if .Params.Liked }} + <anchored-liked> + {{ safeHTML (readFile "static/icons/feather/heart.svg") }} + </anchored-liked> + <span>Liked</span> + {{ end }} + + </anchored-entry> + {{ end }} + + <b>{{ partial "author-name.html" . }}</b> + + · {{ partial "handle.html" . }} + + {{ if .Draft }} + · <draft-label><em>Draft</em></draft-label> + {{ end }} + + · {{- partial "read-time.html" . -}} + + · {{- partial "word-count.html" . -}} + + {{ if .Params.Unlisted }} + · <unlisted-entry title="This message is off the record"> + {{ safeHTML (readFile "static/icons/feather/eye-off.svg") }} + <span>unlisted</span></unlisted-entry> + {{ end }} + + · <a href="/{{ $author.user }}/messages/{{ path.Base .Permalink }}#{{ partial "card-id.html" . }}"> + <time + datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}" + title="{{ .Date | time.Format "Monday, January 2 2006 at 15:04:05 MST" }}"> + {{ .Date | time.Format "Jan 2 2006" }} + </time> + </a> + + {{- if .ExpiryDate -}} + · {{- partial "expiry-date.html" . -}} + {{- end -}} + + · <cite><a title="#{{ partial "card-id.html" . }}" href="#{{ partial "card-id.html" . }}">#id</a></cite> + + {{ if not .ExpiryDate }} + · <cite><a title="/raw/{{ $source }}" href="/raw/{{ $source }}">raw</a></cite> + {{- end -}} +</section> diff --git a/themes/default/layouts/partials/navigator-left.html b/themes/default/layouts/partials/navigator-left.html new file mode 100644 index 0000000..0058b27 --- /dev/null +++ b/themes/default/layouts/partials/navigator-left.html @@ -0,0 +1,17 @@ +{{ if .Site.Menus.main }} +<nav> + <ul> + {{ range .Site.Menus.main }} + <li> + <a id="nav-left-{{ path.Base .Identifier }}" href="{{ .URL }}"> + <span>{{ .Name }}</span> + {{ with .Identifier }} + {{ $icon := print "static/icons/" . ".svg" }} + {{ safeHTML (readFile $icon) }} + {{ end }} + </a> + </li> + {{ end }} + </ul> +</nav> +{{ end }} diff --git a/themes/default/layouts/partials/navigator-middle-walk.html b/themes/default/layouts/partials/navigator-middle-walk.html new file mode 100644 index 0000000..4742822 --- /dev/null +++ b/themes/default/layouts/partials/navigator-middle-walk.html @@ -0,0 +1,15 @@ +{{ if .Context.Site.Menus.main }} + {{ range .Context.Site.Menus.main }} + <icon-navigator hidden> + <icon-button> + <a id="nav-middle-{{ path.Base .Identifier }}" href="{{ .URL }}"> + {{ with .Identifier }} + {{ $icon := print "static/icons/" . ".svg" }} + {{ safeHTML (readFile $icon) }} + {{ end }} + <small>{{ delimit (first 1 (split .Name " ")) " " }}</small> + </a> + </icon-button> + </icon-navigator> + {{ end }} +{{ end }} diff --git a/themes/default/layouts/partials/navigator-middle.html b/themes/default/layouts/partials/navigator-middle.html new file mode 100644 index 0000000..acbd2f1 --- /dev/null +++ b/themes/default/layouts/partials/navigator-middle.html @@ -0,0 +1,58 @@ +{{ $id := .Id }} +{{ $href := .Href }} + +<nav> + <icon-button> + <a + id="{{ or $id "top" }}" + href="{{ or $href "#" }}" + > + {{ with .Icon }} + {{ safeHTML (readFile (print "static/icons/feather/" . ".svg")) }} + {{ else }} + {{ safeHTML (readFile "static/icons/feather/arrow-up.svg") }} + {{ end }} + {{ with .IconLabel }} + <small>{{ . }}</small> + {{ else }} + <small>Top</small> + {{ end }} + </a> + </icon-button> + + <section> + {{ with .Title }} + <h1>{{ . }}</h1> + {{ end }} + {{ with .Subtitle }} + <small>{{ . }}</small> + {{ end }} + </section> + + {{ partial "navigator-middle-walk.html" . }} + + <search-entry> + <form + id="search-form" + action="https://lite.duckduckgo.com/lite/"> + <input required + id="search-input" + name="q" + value="" + type="search" + autocomplete="off" + spellcheck="false" + role="searchbox" + aria-autocomplete="list" + aria-label="search input" + /> + <button id="search-submit"> + {{ safeHTML (readFile "static/icons/feather/search.svg") }} + <small>Search</small> + </button> + <ul hidden id="search-results"></ul> + </form> + </search-entry> + </nav> + +<navigation-separator><hr hidden></navigation-separator> diff --git a/themes/default/layouts/partials/navigator-right-default.html b/themes/default/layouts/partials/navigator-right-default.html new file mode 100644 index 0000000..0b57b8a --- /dev/null +++ b/themes/default/layouts/partials/navigator-right-default.html @@ -0,0 +1,4 @@ +{{ range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.webring) }} + {{- partial "author-list.html" . -}} + {{- partial "web-ring.html" . -}} +{{ end }} diff --git a/themes/default/layouts/partials/navigator-right.html b/themes/default/layouts/partials/navigator-right.html new file mode 100644 index 0000000..4cbcfac --- /dev/null +++ b/themes/default/layouts/partials/navigator-right.html @@ -0,0 +1,3 @@ +{{- partial "gallery-images.html" . -}} +{{- partial "author-list.html" . -}} +{{- partial "web-ring.html" . -}} diff --git a/themes/default/layouts/partials/pagination.html b/themes/default/layouts/partials/pagination.html new file mode 100644 index 0000000..4c1669e --- /dev/null +++ b/themes/default/layouts/partials/pagination.html @@ -0,0 +1,83 @@ +<paginator-navigation> + {{- with .Paginator -}} + + {{ if and .HasPrev .First }} + <a + href="{{ .First.URL }}" + aria-label="First" + title="First" + role="button"> + First + </a> + {{ else }} + <button + disabled + title="Disabled" + aria-label="First"> + First + </button> + {{- end -}} + + {{ with .Prev }} + <a + href="{{ .URL }}" + aria-label="Back" + title="Back" + role="button"> + {{ safeHTML (readFile "static/icons/feather/arrow-left.svg") }} + Back + </a> + {{ else }} + <button + disabled + title="Disabled" + aria-label="Back"> + {{ safeHTML (readFile "static/icons/feather/arrow-left.svg") }} + Back + </button> + {{- end -}} + + {{ + $hidden := (sub .TotalNumberOfElements + (sub (len $.Site.RegularPages) (len (where $.Site.Pages "Type" "page")))) + }} + + + {{ if .Next }} + <a + href="{{ .Next.URL }}" + aria-label="Next" + title="Next" + role="button"> + Next + {{ safeHTML (readFile "static/icons/feather/arrow-right.svg") }} + </a> + {{ else }} + <button + disabled + title="Disabled" + aria-label="Next"> + Next + {{ safeHTML (readFile "static/icons/feather/arrow-right.svg") }} + </button> + {{- end -}} + + + {{ if and .HasNext .Last }} + <a + href="{{ .Last.URL }}" + aria-label="Last" + title="Next" + role="button"> + Last + </a> + {{ else }} + <button + disabled + title="Disabled" + aria-label="Last"> + Last + </button> + {{- end -}} + {{ end }} +</paginator-navigation> diff --git a/themes/default/layouts/partials/profile-picture.html b/themes/default/layouts/partials/profile-picture.html new file mode 100644 index 0000000..fba35f7 --- /dev/null +++ b/themes/default/layouts/partials/profile-picture.html @@ -0,0 +1,9 @@ +<figure> + <picture> + <source srcset="/{{ partial "author-media-path.html" . }}/profile/picture.png" type="image/png" /> + <source srcset="/{{ partial "author-media-path.html" . }}/profile/picture.jpg" type="image/jpeg" /> + <source srcset="/{{ partial "author-media-path.html" . }}/profile/picture.webp" type="image/webp" /> + <img alt="{{ .Title }}" src="/{{ partial "author-media-path.html" . }}/profile/picture.png" /> + </picture> + {{ partial "context-profile.html" . }} +</figure> diff --git a/themes/default/layouts/partials/profile-tabs.html b/themes/default/layouts/partials/profile-tabs.html new file mode 100644 index 0000000..94b80ff --- /dev/null +++ b/themes/default/layouts/partials/profile-tabs.html @@ -0,0 +1,8 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} + +<tab-list> + <a href="/{{ $author.user }}">Messages</a> + <a href="/{{ $author.user }}/feeds/">Feeds</a> + <a href="/{{ $author.user }}/media/">Media</a> + <a href="/{{ $author.user }}/likes/">Likes</a> +</tab-list> diff --git a/themes/default/layouts/partials/profile.html b/themes/default/layouts/partials/profile.html new file mode 100644 index 0000000..b20159f --- /dev/null +++ b/themes/default/layouts/partials/profile.html @@ -0,0 +1,52 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} + +<micro-header> + + <micro-header-image> + <picture> + <img alt="{{ .Title }}" src="/{{ partial "author-media-path.html" . }}/profile/header.jpg" /> + </picture> + </micro-header-image> + + <micro-header-picture> + <picture> + <img src="/{{ partial "author-media-path.html" . }}/profile/picture.png"/> + </picture> + </micro-header-picture> + + <section> + <micro-header-title> + <h1>{{ $author.name }}</h1> + <h2>@{{ $author.user }}</h2> + </micro-header-title> + <micro-header-description> + <p> + {{ $author.description | markdownify }} + </p> + </micro-header-description> + </section> + + <footer> + <p> + {{ safeHTML (readFile "static/icons/feather/map-pin.svg") }} + <span>{{- $author.place | markdownify -}}</span> + </p> + <p> + {{ safeHTML (readFile "static/icons/feather/globe.svg") }} + <a href="{{ $author.domain.url }}"> + {{- $author.domain.host | markdownify -}} + </a> + </p> + <p> + {{ safeHTML (readFile "static/icons/feather/clock.svg") }} + <span>{{- $author.epoch | markdownify -}}</span> + </p> + <p> + {{ safeHTML (readFile "static/icons/feather/user.svg") }} + <span><b>{{ with $author.webring.rss }}{{ len . }}{{ else }} 0 {{ end }}</b> Following</span> + </p> + </footer> + +</micro-header> + +{{ partial "profile-tabs.html" . }} diff --git a/themes/default/layouts/partials/read-time.html b/themes/default/layouts/partials/read-time.html new file mode 100644 index 0000000..5b6ca62 --- /dev/null +++ b/themes/default/layouts/partials/read-time.html @@ -0,0 +1,6 @@ +{{ $seconds := mul (div .WordCount 180.0) 60.0 }} +{{ $format := printf "%.0f" $seconds | strings.TrimRight "0" | strings.TrimRight "." }} + +<read-time title="Takes {{ $format }} seconds to read"> + {{ $format }} sec +</read-time> diff --git a/themes/default/layouts/partials/site-description.html b/themes/default/layouts/partials/site-description.html new file mode 100644 index 0000000..8d021de --- /dev/null +++ b/themes/default/layouts/partials/site-description.html @@ -0,0 +1,8 @@ +{{- if .Params.summary -}} + {{ .Params.summary }} +{{- else if .Summary -}} + {{ .Summary }} +{{- else -}} + {{- block "description" . -}}{{- end -}} + {{- partial "site-title.html" . -}} +{{- end -}} diff --git a/themes/default/layouts/partials/site-title.html b/themes/default/layouts/partials/site-title.html new file mode 100644 index 0000000..ed09ec3 --- /dev/null +++ b/themes/default/layouts/partials/site-title.html @@ -0,0 +1,15 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} + +{{- if not (eq .Title $.Site.Title) -}} + {{- with or .Title .Summary -}} + {{ . }} — + {{ end }} +{{- end -}} + +{{- with $.Site.Title -}} + {{ if $.IsHome -}} + {{ . }} + {{- else -}} + {{ $author.blogtitle }} + {{- end -}} +{{- end -}} diff --git a/themes/default/layouts/partials/styles-navigator.html b/themes/default/layouts/partials/styles-navigator.html new file mode 100644 index 0000000..725f8c4 --- /dev/null +++ b/themes/default/layouts/partials/styles-navigator.html @@ -0,0 +1,14 @@ +icon-navigator a[href="{{ .Link }}"], +column-left nav a[href="{{ .Link }}"] { + font-weight: 700; +} + +column-left nav a[href="{{ .Link }}"] { + background-color: #f0f6ff; + background-color: var(--hover-alternate); +} + +icon-navigator a[href="{{ .Link }}"] svg { + fill: #e5f0ff; + fill: var(--active-alternate); +} diff --git a/themes/default/layouts/partials/tags.html b/themes/default/layouts/partials/tags.html new file mode 100644 index 0000000..d601b27 --- /dev/null +++ b/themes/default/layouts/partials/tags.html @@ -0,0 +1,5 @@ +{{- with .Params.tags }} + {{- range $tags, $tag := sort . }} + <a href="{{ "tags/" | relURL }}{{ $tag | urlize }}/">#{{ $tag }}</a> + {{ end }} +{{ end }} diff --git a/themes/default/layouts/partials/title.html b/themes/default/layouts/partials/title.html new file mode 100644 index 0000000..988167f --- /dev/null +++ b/themes/default/layouts/partials/title.html @@ -0,0 +1 @@ +{{- (or .Title .Summary) | markdownify -}} diff --git a/themes/default/layouts/partials/web-ring.html b/themes/default/layouts/partials/web-ring.html new file mode 100644 index 0000000..4ddfa14 --- /dev/null +++ b/themes/default/layouts/partials/web-ring.html @@ -0,0 +1,138 @@ +{{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}} + +{{- if $author.webring.rss -}} + + {{ $feeds := slice }} + + {{ range first 5 $author.webring.rss -}} + + {{ with resources.GetRemote . }} + {{- with .Err -}} + {{- warnf "%s" . -}} + {{- end -}} + {{ end }} + + {{ with resources.GetRemote . | transform.Unmarshal -}} + + {{- $title := "Example Domain" -}} + {{- $link := "https://example.com/link" -}} + {{- $description := "This domain is for use in illustrative examples in documents." -}} + {{- $content := "This content is for use in illustrative examples in documents." -}} + {{- $sourceTitle := "From Example Domain" -}} + {{- $sourceLink := "https://example.com/" -}} + {{- $sourceDescription := "The example domain." -}} + {{- $date := now.Format "January 2, 2006" -}} + {{- $dateTime := now.Format "2006-01-02T15:04:05Z" -}} + {{- $dateTitle := now.Format "Monday, January 2 2006 at 15:04:05 MST" -}} + + {{ with .channel -}} + + {{ if reflect.IsMap (index .link 0) -}} + {{ $sourceLink = index (index .link 0) "-href" | plainify | htmlUnescape -}} + {{ else -}} + {{ $sourceLink = index .link 0 | plainify | htmlUnescape -}} + {{ end -}} + + {{ $sourceDescription = .description | plainify | htmlUnescape -}} + + {{ $sourceTitle = .title | plainify | htmlUnescape -}} + + {{ range first 1 .item -}} + {{ $description = .description | plainify | htmlUnescape | truncate 50 "..." -}} + {{ $content = .description | plainify | htmlUnescape -}} + {{ $title = .title | plainify | htmlUnescape -}} + {{ $link = .link | plainify | htmlUnescape -}} + {{ $date = .pubDate | plainify | htmlUnescape | time.Format "January 2, 2006" -}} + {{ $dateTime = .pubDate | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z" -}} + {{ $dateTitle = .pubDate | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}} + {{ end -}} + + {{ else -}} + + {{ $sourceLink = index (index .link 0) "-href" | plainify | htmlUnescape -}} + {{ $sourceTitle = .title | plainify | htmlUnescape -}} + {{ $sourceDescription = .subtitle | plainify | htmlUnescape -}} + + {{ range first 1 .entry -}} + + {{ if reflect.IsMap .title -}} + {{ $title = index .title "#text" | plainify | htmlUnescape -}} + {{ else -}} + {{ $title = .title | plainify | htmlUnescape -}} + {{ end -}} + + {{ $date = .updated | plainify | htmlUnescape | time.Format "January 2, 2006" -}} + {{ $dateTime = .updated | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z" -}} + {{ $dateTitle = .updated | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}} + + {{ $link = .id -}} + {{ with .content -}} + {{ $description = (index . "#text") | plainify | htmlUnescape | truncate 50 "..." -}} + {{ $content = (index . "#text") | plainify | htmlUnescape -}} + {{ end -}} + {{ with .summary -}} + {{ $description = (index . "#text") | plainify | htmlUnescape | truncate 50 "..." -}} + {{ $content = (index . "#text") | plainify | htmlUnescape -}} + {{ end -}} + {{ end -}} + + {{ end -}} + + {{ + $feeds = $feeds | append (dict + "FeedTitle" $title + "FeedLink" $link + "FeedDescription" $description + "FeedContent" $content + "FeedSourceTitle" $sourceTitle + "FeedSourceLink" $sourceLink + "FeedSourceDescription" $sourceDescription + "FeedDate" $date + "FeedDateTime" $dateTime + "FeedDateTitle" $dateTitle + ) + }} + + {{ end }} + {{ end }} + + <web-ring> + <h1>Web Ring</h1> + <section> + {{ range sort $feeds "FeedDateTime" "desc" }} + <web-ring-item> + <header> + <a + rel="noopener" + target="_blank" + title="{{ .FeedLink }}" + href="{{ .FeedLink }}"> + {{ .FeedTitle }} + </a> + </header> + + <p> + <time + title="{{ .FeedDateTitle }}" + datetime="{{ .FeedDateTime }}"> + {{ .FeedDate }} + </time> + {{- with .FeedDescription -}} + {{ "--" | markdownify }} + {{ . }} + {{- end }} + </p> + + <a + rel="noopener" + target="_blank" + title="{{ .FeedSourceDescription }}" + href="{{ .FeedSourceLink }}"> + {{ .FeedSourceTitle }} + </a> + </web-ring-item> + {{ end }} + </section> + </web-ring> + +{{ end -}} diff --git a/themes/default/layouts/partials/word-count.html b/themes/default/layouts/partials/word-count.html new file mode 100644 index 0000000..f566b07 --- /dev/null +++ b/themes/default/layouts/partials/word-count.html @@ -0,0 +1,14 @@ +{{ $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }} +{{ $limit := $author.wordlimit }} +{{ $wordLimit := gt .WordCount $limit }} +{{ $overLimit := sub .WordCount $limit }} + +<word-limit title="{{- if $wordLimit -}}{{ $overLimit }} words over the limit{{ else }} {{ .WordCount }} words {{ end }}"> + <word-count> + {{- if $wordLimit -}} + <em>{{ .WordCount }}</em> + {{- else -}} + {{ .WordCount }} + {{- end -}} + </word-count>/{{ $limit }} words +</word-limit> diff --git a/themes/default/layouts/shortcodes/abbr.html b/themes/default/layouts/shortcodes/abbr.html new file mode 100644 index 0000000..d661bd5 --- /dev/null +++ b/themes/default/layouts/shortcodes/abbr.html @@ -0,0 +1,4 @@ +{{- $abbr := default "TL;DR:" (.Get "abbr" | default (.Get 0)) -}} +{{- $title := default "Too long, didn't read" (.Get "title" | default (.Get 1)) -}} + +<abbr title="{{ $title }}">{{ $abbr | markdownify }}</abbr> diff --git a/themes/default/layouts/shortcodes/asciicast.html b/themes/default/layouts/shortcodes/asciicast.html new file mode 100644 index 0000000..10da091 --- /dev/null +++ b/themes/default/layouts/shortcodes/asciicast.html @@ -0,0 +1,17 @@ +{{- $id := default "" (.Get "id" | default (.Get 0)) -}} +{{- $title := default "" (.Get "title" | default (.Get 1)) -}} +{{- $theme := default "" (.Get "theme" | default (.Get 2)) -}} +{{- $speed := default "" (.Get "speed" | default (.Get 3)) -}} +{{- $preload := default "" (.Get "preload" | default (.Get 4)) -}} +{{- $autoplay := default "" (.Get "autoplay" | default (.Get 5)) -}} +{{- $startat := default "" (.Get "startat" | default (.Get 6)) -}} + +<ascii-cast> + <script + src="https://asciinema.org/a/14.js" + id="asciicast-14" + async + data-autoplay="false" + data-size="big" + ></script> +</ascii-cast> diff --git a/themes/default/layouts/shortcodes/audio.html b/themes/default/layouts/shortcodes/audio.html new file mode 100644 index 0000000..4df2f51 --- /dev/null +++ b/themes/default/layouts/shortcodes/audio.html @@ -0,0 +1,18 @@ +{{- $src := default + "https://ia600701.us.archive.org/12/items/firstchaptercollection001_1109_librivox/firstchapter001_02_taletwocities_dickens_law.mp3" + (.Get "src" | default (.Get 0)) +-}} +{{- $caption := default "A Tale of Two Cities by Charles Dickens" (.Get "caption" | default (.Get 1)) -}} +{{- $controls := default "" (.Get "controls" | default (.Get 2)) -}} + +<audio-player> + <figure> + <figcaption>{{ $caption }}</figcaption> + <audio controls {{ $controls | safeHTMLAttr }} src="{{ $src }}"> + <p> + Your browser doesn't support HTML5 <code>audio</code>. Here is a + <a href="{{ $src }}">link to the audio file</a> instead. + </p> + </audio> + </figure> +</audio-player> diff --git a/themes/default/layouts/shortcodes/gist.html b/themes/default/layouts/shortcodes/gist.html new file mode 100644 index 0000000..c475672 --- /dev/null +++ b/themes/default/layouts/shortcodes/gist.html @@ -0,0 +1,9 @@ +{{- $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/iframe.html b/themes/default/layouts/shortcodes/iframe.html new file mode 100644 index 0000000..cd72763 --- /dev/null +++ b/themes/default/layouts/shortcodes/iframe.html @@ -0,0 +1,13 @@ +{{- $url := default "https://example.org/" (.Get "url" | default (.Get 0)) -}} +{{- $title := default "Content Embed" (.Get "title" | default (.Get 1)) -}} +{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}} +{{- $sandbox := default "" (.Get "sandbox" | default (.Get 3)) -}} + +<iframe-embed> + <iframe + sandbox="{{ $sandbox }}" + src="{{ $url }}" + title="{{ $title }}" + ></iframe> + <figcaption>{{ $caption | markdownify }}</figcaption> +</iframe-embed> diff --git a/themes/default/layouts/shortcodes/imgur-video.html b/themes/default/layouts/shortcodes/imgur-video.html new file mode 100644 index 0000000..e6fabdd --- /dev/null +++ b/themes/default/layouts/shortcodes/imgur-video.html @@ -0,0 +1,20 @@ +{{- $id := default "uVrh84e" (.Get "id" | default (.Get 0)) -}} +{{- $title := default "Imgur Gif" (.Get "title" | default (.Get 1)) -}} + +<imgur-video> + <blockquote + class="imgur-embed-pub" + lang="en" + data-id="{{ $id }}" + data-context="false"> + <a href="//imgur.com/{{ $id }}"></a> + </blockquote> + <script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script> + <noscript> + <a href="//imgur.com/{{ $id }}">imgur.com/{{ $id }}</a> + </noscript> + <figcaption> + {{ $title | markdownify }}: + {{ print "[Link](https://imgur.com/" $id ")" | markdownify }} + </figcaption> +</imgur-video> diff --git a/themes/default/layouts/shortcodes/imgur.html b/themes/default/layouts/shortcodes/imgur.html new file mode 100644 index 0000000..f51bcef --- /dev/null +++ b/themes/default/layouts/shortcodes/imgur.html @@ -0,0 +1,13 @@ +{{- $id := default "mkVcxUi" (.Get "id" | default (.Get 0)) -}} + +<imgur-image> + <blockquote + class="imgur-embed-pub" + lang="en" + data-id="a/{{ $id }}" + data-context="false" + > + <a href="//imgur.com/a/{{ $id }}"></a> + </blockquote> + <script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script> +</imgur-image> diff --git a/themes/default/layouts/shortcodes/ins.html b/themes/default/layouts/shortcodes/ins.html new file mode 100644 index 0000000..3c68f1f --- /dev/null +++ b/themes/default/layouts/shortcodes/ins.html @@ -0,0 +1,3 @@ +{{- $text := default "inserted text" (.Get "text" | default (.Get 0)) -}} + +<ins title="{{ $text }}">{{ $text | markdownify }}</ins> diff --git a/themes/default/layouts/shortcodes/kbd.html b/themes/default/layouts/shortcodes/kbd.html new file mode 100644 index 0000000..b24fd9d --- /dev/null +++ b/themes/default/layouts/shortcodes/kbd.html @@ -0,0 +1,3 @@ +{{- $key := default "Ctrl" (.Get "key" | default (.Get 0)) -}} + +<kbd title="{{ $key }}">{{ $key | markdownify }}</kbd> diff --git a/themes/default/layouts/shortcodes/mark.html b/themes/default/layouts/shortcodes/mark.html new file mode 100644 index 0000000..02af225 --- /dev/null +++ b/themes/default/layouts/shortcodes/mark.html @@ -0,0 +1,5 @@ +{{- $text := default "highligted text" (.Get "text" | default (.Get 0)) -}} +{{- $title := default $text (.Get "title" | default (.Get 1)) -}} + +<mark title="{{ $title }}">{{ $text }}</mark> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/odysee.html b/themes/default/layouts/shortcodes/odysee.html new file mode 100644 index 0000000..91f03c0 --- /dev/null +++ b/themes/default/layouts/shortcodes/odysee.html @@ -0,0 +1,14 @@ +{{- $url := default "https://odysee.com/$/embed/odysee/7a416c44a6888d94fe045241bbac055c726332aa" (.Get "url" | default (.Get 0)) -}} +{{- $title := default "Odysee Video" (.Get "title" | default (.Get 1)) -}} +{{- $caption := default (print $title ": [Link](" $url ")") (.Get "caption" | default (.Get 2)) -}} + +<odysee-video> + <iframe + sandbox="allow-scripts allow-same-origin allow-presentation" + id="odysee-iframe" + src="{{ $url }}" + title="{{ $title }}" + allowfullscreen> + </iframe> + <figcaption>{{ $caption | markdownify }}</figcaption> +</odysee-video> diff --git a/themes/default/layouts/shortcodes/pdf.html b/themes/default/layouts/shortcodes/pdf.html new file mode 100644 index 0000000..f766190 --- /dev/null +++ b/themes/default/layouts/shortcodes/pdf.html @@ -0,0 +1,11 @@ +{{- $url := default "https://www.gutenberg.org/files/98/old/2city12p.pdf" (.Get "url" | default (.Get 0)) -}} +{{- $title := default "PDF Document" (.Get "title" | default (.Get 1)) -}} +{{- $caption := default (print $title ": [Download](" $url ")") (.Get "caption" | default (.Get 2)) -}} + +<pdf-container title="{{ $title }}"> + <iframe loading="lazy" + sandbox="allow-scripts allow-presentation allow-same-origin" + src="https://docs.google.com/gview?url={{ $url }}&embedded=true"> + </iframe> + <figcaption>{{ $caption | markdownify }}</figcaption> +</pdf-container> diff --git a/themes/default/layouts/shortcodes/quote.html b/themes/default/layouts/shortcodes/quote.html new file mode 100644 index 0000000..b933286 --- /dev/null +++ b/themes/default/layouts/shortcodes/quote.html @@ -0,0 +1,13 @@ +{{- $text := default "Speech is silver, silence is golden" (.Get "text" | default (.Get 0)) -}} +{{- $cite := default "" (.Get "cite" | default (.Get 1)) -}} + +<q cite="$cite" title="{{ $text | markdownify }}"> + {{- if $cite -}} + <a rel="noopener" href="{{ $cite }}" target="_blank"> + {{- end -}} + {{ $text | markdownify }} + {{- if $cite -}} + </a> + {{- end -}} +</q> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/reddit.html b/themes/default/layouts/shortcodes/reddit.html new file mode 100644 index 0000000..10ef0b9 --- /dev/null +++ b/themes/default/layouts/shortcodes/reddit.html @@ -0,0 +1,29 @@ +{{- $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/self.html b/themes/default/layouts/shortcodes/self.html new file mode 100644 index 0000000..3b620b7 --- /dev/null +++ b/themes/default/layouts/shortcodes/self.html @@ -0,0 +1,13 @@ +{{- $url := default "https://example.org/" (.Get "url" | default (.Get 0)) -}} +{{- $title := default "Self Embed" (.Get "title" | default (.Get 1)) -}} +{{- $caption := default (print $title ": [Link](" $url ")") (.Get "caption" | default (.Get 2)) -}} +{{- $sandbox := default "" (.Get "sandbox" | default (.Get 3)) -}} + +<self-embed> + <iframe + sandbox="{{ $sandbox }}" + src="{{ $url }}" + title="{{ $title }}" + ></iframe> + <figcaption>{{ $caption | markdownify }}</figcaption> +</self-embed> diff --git a/themes/default/layouts/shortcodes/smallcaps.html b/themes/default/layouts/shortcodes/smallcaps.html new file mode 100644 index 0000000..8c18621 --- /dev/null +++ b/themes/default/layouts/shortcodes/smallcaps.html @@ -0,0 +1,6 @@ +{{- $text := default "Small Caps" (.Get "text" | default (.Get 0)) -}} + +<samp title="{{ $text }}"> + {{- $text | markdownify -}} +</samp> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/spoiler.html b/themes/default/layouts/shortcodes/spoiler.html new file mode 100644 index 0000000..9267876 --- /dev/null +++ b/themes/default/layouts/shortcodes/spoiler.html @@ -0,0 +1,9 @@ +{{- $text := default "This is a spoiler." (.Get "text" | default (.Get 0)) -}} +{{- $title := default "Click to show/hide text." (.Get "title" | default (.Get 1)) -}} + +{{ if gt (len .Inner) 1 }} + {{ $text = .Inner }} +{{ end }} + +<input hidden type="checkbox" id="spoiler-text-{{ md5 $text }}" /> +<s title="{{ $title }}"><label for="spoiler-text-{{ md5 $text }}">{{ $text | markdownify }}</label></s> diff --git a/themes/default/layouts/shortcodes/spoiler.rss.xml b/themes/default/layouts/shortcodes/spoiler.rss.xml new file mode 100644 index 0000000..ad80424 --- /dev/null +++ b/themes/default/layouts/shortcodes/spoiler.rss.xml @@ -0,0 +1,4 @@ +{{- $text := default "This is a spoiler." (.Get "text" | default (.Get 0)) -}} +{{- $title := default "Click to show/hide text." (.Get "title" | default (.Get 1)) -}} + +<s title="{{ $title }}">{{ $text | markdownify }}</s> diff --git a/themes/default/layouts/shortcodes/tweet.html b/themes/default/layouts/shortcodes/tweet.html new file mode 100644 index 0000000..b4adfba --- /dev/null +++ b/themes/default/layouts/shortcodes/tweet.html @@ -0,0 +1,18 @@ +{{- $user := default "jack" (.Get "user" | default (.Get 0)) -}} +{{- $status := default "20" (.Get "status" | default (.Get 1)) -}} +{{- $caption := default "Twitter Tweet" (.Get "caption" | default (.Get 2)) -}} + +<twitter-tweet> + <blockquote class="twitter-tweet"> + <a href="https://twitter.com/{{ $user }}/status/{{ $status }}"> + https://twitter.com/{{ $user }}/status/{{ $status }} + </a> + </blockquote> + <script + async + src="https://platform.twitter.com/widgets.js" + charset="utf-8"> + </script> +</twitter-tweet> + +<figcaption>{{ $caption }}</figcaption> diff --git a/themes/default/layouts/shortcodes/video.html b/themes/default/layouts/shortcodes/video.html new file mode 100644 index 0000000..7c0c95f --- /dev/null +++ b/themes/default/layouts/shortcodes/video.html @@ -0,0 +1,36 @@ +{{- + $source := default + "https://raw.githubusercontent.com/benhosmer/HTML5-Test-Videos/9a6c2db46472454c634963cbeb0900fd37901fac/big_buck_bunny" + (.Get "source" | default (.Get 0)) +-}} +{{- $poster := default "" (.Get "poster" | default (.Get 1)) -}} +{{- $width := default "" (.Get "width" | default (.Get 2)) -}} +{{- $height := default "" (.Get "height" | default (.Get 3)) -}} +{{- $preload := default "metadata" (.Get "preload" | default (.Get 4)) -}} +{{- $controls := default "" (.Get "controls" | default (.Get 5)) -}} +{{- $caption := default "`HTML5` Video" (.Get "caption" | default (.Get 6)) -}} +{{- $title := default "HTML5 Video" (.Get "title" | default (.Get 7)) -}} +{{- $start := default "" (.Get "start" | default (.Get 8)) -}} +{{- $end := default "" (.Get "end" | default (.Get 9)) -}} + +<video-container> + <video + title="{{ $title }}" + preload="{{ $preload }}" + poster="{{ $poster }}" + width="{{ $width }}" + height="{{ $height }}" + controls {{ $controls | safeHTMLAttr }}> + <source src="{{ $source }}.mp4#t={{ $start }},{{ $end }}" type="video/mp4"> + <source src="{{ $source }}.webm#t={{ $start }},{{ $end }}" type="video/webm"> + <source src="{{ $source }}.flv#t={{ $start }},{{ $end }}" type="video/flv"> + <source src="{{ $source }}.ogv#t={{ $start }},{{ $end }}" type="video/ogv"> + <p> + Sorry, your browser doesn't support embedded videos. Here is a + <a href="{{ $source }}.mp4#t={{ $start }},{{ $end }}"> + link to the video + </a> instead. + </p> + </video> + <figcaption>{{ $caption | markdownify }}</figcaption> +</video-container> diff --git a/themes/default/layouts/shortcodes/vimeo.html b/themes/default/layouts/shortcodes/vimeo.html new file mode 100644 index 0000000..009ebb0 --- /dev/null +++ b/themes/default/layouts/shortcodes/vimeo.html @@ -0,0 +1,12 @@ +{{- $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> diff --git a/themes/default/layouts/shortcodes/wikipedia.html b/themes/default/layouts/shortcodes/wikipedia.html new file mode 100644 index 0000000..7b9e51f --- /dev/null +++ b/themes/default/layouts/shortcodes/wikipedia.html @@ -0,0 +1,16 @@ +{{- $id := default "Knowledge" (.Get "id" | default (.Get 0)) -}} +{{- $title := default "Wikipedia Article" (.Get "title" | default (.Get 1)) -}} +{{- + $caption := default + (print $title ": [Link](" "https://en.m.wikipedia.org/wiki/" $id ")") + (.Get "caption" | default (.Get 2)) +-}} + +<wikipedia-container title="{{ $title }}"> + <iframe loading="lazy" + src="https://en.m.wikipedia.org/wiki/{{ $id }}" + title="{{ $title }}" + height="300" + ></iframe> + <figcaption>{{ $caption | markdownify }}</figcaption> +</wikipedia-container> diff --git a/themes/default/layouts/shortcodes/youtube.html b/themes/default/layouts/shortcodes/youtube.html new file mode 100644 index 0000000..791e3da --- /dev/null +++ b/themes/default/layouts/shortcodes/youtube.html @@ -0,0 +1,29 @@ +{{- $url := "www.youtube-nocookie.com" -}} +{{- $id := default "aqz-KE-bpKQ" (.Get "id" | default (.Get 0)) -}} +{{- $title := default "YouTube Video" (.Get "title" | default (.Get 1)) -}} +{{- $start := default "" (.Get "start" | default (.Get 2)) -}} +{{- $end := default "" (.Get "end" | default (.Get 3)) -}} +{{- $muted := default "" (.Get "muted" | default (.Get 4)) -}} + +{{- if (and $start $end) -}} + {{ $start = print "&start=" $start }} + {{ $end = print "&end=" $end }} +{{- end -}} + +{{- if $muted -}} + {{ $muted = "&mute=1" }} +{{- end -}} + +<youtube-video> + <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"> + <iframe loading="lazy" sandbox="allow-scripts allow-same-origin" + src="https://{{ $url }}/embed/{{ $id }}{{ "?controls=1" }}{{ $start }}{{ $end }}{{ $muted }}" + style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" + allowfullscreen title="{{ $title }}"> + </iframe> + </div> + <figcaption> + {{ $title | markdownify }}: + {{ print "[Link](https://www.youtube.com/watch?v=" $id ")" | markdownify }} + </figcaption> +</youtube-video> |