website

My personal website www.ortlepp.eu
git clone https://git.ortlepp.eu/website.git/
Log | Files | Refs

commit b6b7b10d0fb04af54e2bca9dbc3fafbef42f80e9
parent 0e5b97a6d7bf0b87a53828842a64084899cbfa14
Author: Thorsten Ortlepp <post@ortlepp.eu>
Date:   Tue,  1 Feb 2022 23:52:19 +0100

Update PaperMod to version 6.0

Diffstat:
Mconfig.yml | 2++
Dlayouts/_default/rss.xml | 47-----------------------------------------------
Mlayouts/_default/single.html | 54+++++++++++++++++-------------------------------------
Mlayouts/partials/footer.html | 98++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
Mlayouts/partials/post_meta.html | 22+++++++++++-----------
Mstatic/css/custom.css | 2+-
Mthemes/PaperMod/.github/ISSUE_TEMPLATE/bug_report.md | 10+++++-----
Athemes/PaperMod/.github/ISSUE_TEMPLATE/config.yml | 5+++++
Athemes/PaperMod/.github/ISSUE_TEMPLATE/new-blank-issue.md | 7+++++++
Athemes/PaperMod/.github/PULL_REQUEST_TEMPLATE.md | 44++++++++++++++++++++++++++++++++++++++++++++
Mthemes/PaperMod/.github/workflows/build.yml | 2+-
Mthemes/PaperMod/.github/workflows/gh-pages.yml | 2+-
Mthemes/PaperMod/README.md | 35+++++++++++++++++++----------------
Dthemes/PaperMod/assets/css/404.css | 11-----------
Dthemes/PaperMod/assets/css/an-old-hope.min.css | 64----------------------------------------------------------------
Dthemes/PaperMod/assets/css/archive.css | 44--------------------------------------------
Athemes/PaperMod/assets/css/common/404.css | 11+++++++++++
Athemes/PaperMod/assets/css/common/archive.css | 44++++++++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/common/footer.css | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/common/header.css | 97+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/common/main.css | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/common/post-entry.css | 104+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/common/post-single.css | 430+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/common/profile-mode.css | 43+++++++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/common/search.css | 45+++++++++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/common/terms.css | 18++++++++++++++++++
Athemes/PaperMod/assets/css/core/reset.css | 138+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/core/theme-vars.css | 38++++++++++++++++++++++++++++++++++++++
Athemes/PaperMod/assets/css/core/zmedia.css | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dthemes/PaperMod/assets/css/footer.css | 56--------------------------------------------------------
Dthemes/PaperMod/assets/css/header.css | 97-------------------------------------------------------------------------------
Athemes/PaperMod/assets/css/hljs/an-old-hope.min.css | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dthemes/PaperMod/assets/css/main.css | 45---------------------------------------------
Dthemes/PaperMod/assets/css/post-entry.css | 106-------------------------------------------------------------------------------
Dthemes/PaperMod/assets/css/post-single.css | 433-------------------------------------------------------------------------------
Dthemes/PaperMod/assets/css/profile-mode.css | 46----------------------------------------------
Dthemes/PaperMod/assets/css/reset.css | 138-------------------------------------------------------------------------------
Dthemes/PaperMod/assets/css/search.css | 45---------------------------------------------
Dthemes/PaperMod/assets/css/terms.css | 18------------------
Dthemes/PaperMod/assets/css/theme-vars.css | 38--------------------------------------
Dthemes/PaperMod/assets/css/zmedia.css | 53-----------------------------------------------------
Mthemes/PaperMod/assets/js/fastsearch.js | 115+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
Athemes/PaperMod/i18n/bn.yaml | 28++++++++++++++++++++++++++++
Athemes/PaperMod/i18n/ckb.yaml | 25+++++++++++++++++++++++++
Athemes/PaperMod/i18n/da.yaml | 28++++++++++++++++++++++++++++
Mthemes/PaperMod/i18n/en.yaml | 6++++++
Athemes/PaperMod/i18n/eo.yaml | 25+++++++++++++++++++++++++
Mthemes/PaperMod/i18n/es.yaml | 10++++++++++
Mthemes/PaperMod/i18n/fa.yaml | 21+++++++++++++++++----
Mthemes/PaperMod/i18n/fr.yaml | 23+++++++++++++++++++++++
Mthemes/PaperMod/i18n/it.yaml | 6++++++
Mthemes/PaperMod/i18n/ko.yaml | 20++++++++++++++++++++
Athemes/PaperMod/i18n/ku.yaml | 25+++++++++++++++++++++++++
Athemes/PaperMod/i18n/mn.yaml | 25+++++++++++++++++++++++++
Athemes/PaperMod/i18n/nl.yaml | 28++++++++++++++++++++++++++++
Athemes/PaperMod/i18n/pl.yaml | 28++++++++++++++++++++++++++++
Mthemes/PaperMod/i18n/ru.yaml | 20+++++++++++++++-----
Athemes/PaperMod/i18n/tr.yaml | 25+++++++++++++++++++++++++
Athemes/PaperMod/i18n/uk.yaml | 26++++++++++++++++++++++++++
Athemes/PaperMod/i18n/vi.yaml | 25+++++++++++++++++++++++++
Athemes/PaperMod/i18n/zh-tw.yaml | 25+++++++++++++++++++++++++
Mthemes/PaperMod/i18n/zh.yaml | 9+++++++++
Mthemes/PaperMod/layouts/404.html | 5++---
Mthemes/PaperMod/layouts/_default/archives.html | 10++++++++--
Mthemes/PaperMod/layouts/_default/baseof.html | 7+++----
Mthemes/PaperMod/layouts/_default/list.html | 30++++++++++++++++++++----------
Mthemes/PaperMod/layouts/_default/rss.xml | 5++++-
Mthemes/PaperMod/layouts/_default/search.html | 7++++---
Mthemes/PaperMod/layouts/_default/single.html | 54+++++++++++++++++-------------------------------------
Mthemes/PaperMod/layouts/_default/terms.html | 4++--
Mthemes/PaperMod/layouts/partials/anchored_headings.html | 2+-
Mthemes/PaperMod/layouts/partials/author.html | 4++--
Mthemes/PaperMod/layouts/partials/breadcrumbs.html | 12++++++------
Mthemes/PaperMod/layouts/partials/comments.html | 9+++------
Mthemes/PaperMod/layouts/partials/cover.html | 23++++++++++++++---------
Mthemes/PaperMod/layouts/partials/edit_post.html | 8+++++---
Mthemes/PaperMod/layouts/partials/extend_footer.html | 8+++-----
Mthemes/PaperMod/layouts/partials/extend_head.html | 10++++------
Mthemes/PaperMod/layouts/partials/footer.html | 99++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
Mthemes/PaperMod/layouts/partials/head.html | 181+++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
Mthemes/PaperMod/layouts/partials/header.html | 81+++++++++++++++++++++++--------------------------------------------------------
Mthemes/PaperMod/layouts/partials/home_info.html | 8++++----
Mthemes/PaperMod/layouts/partials/index_profile.html | 18++++++++++--------
Athemes/PaperMod/layouts/partials/post_canonical.html | 9+++++++++
Mthemes/PaperMod/layouts/partials/post_meta.html | 22+++++++++++-----------
Athemes/PaperMod/layouts/partials/post_nav_links.html | 19+++++++++++++++++++
Mthemes/PaperMod/layouts/partials/share_icons.html | 26+++++++++++++++++++++-----
Mthemes/PaperMod/layouts/partials/social_icons.html | 9+++++----
Mthemes/PaperMod/layouts/partials/svg.html | 98+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Mthemes/PaperMod/layouts/partials/templates/opengraph.html | 8--------
Mthemes/PaperMod/layouts/partials/templates/schema_json.html | 8++++----
Mthemes/PaperMod/layouts/partials/templates/twitter_cards.html | 6------
Mthemes/PaperMod/layouts/partials/toc.html | 157++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Mthemes/PaperMod/layouts/partials/translation_list.html | 10+++++-----
Mthemes/PaperMod/layouts/shortcodes/collapse.html | 6+-----
Mthemes/PaperMod/theme.toml | 2+-
96 files changed, 2474 insertions(+), 1775 deletions(-)

diff --git a/config.yml b/config.yml @@ -32,8 +32,10 @@ params: ShowPostNavLinks: true ShowBreadCrumbs: true ShowCodeCopyButtons: false + ShowFullTextinRSS: true disableSpecial1stPost: false disableScrollToTop: false + disableAnchoredHeadings: true comments: false hidemeta: false hideSummary: false diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml @@ -1,47 +0,0 @@ -{{- $pctx := . -}} -{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} -{{- $pages := slice -}} -{{- if or $.IsHome $.IsSection -}} -{{- $pages = $pctx.RegularPages -}} -{{- else -}} -{{- $pages = $pctx.Pages -}} -{{- end -}} -{{- $limit := .Site.Config.Services.RSS.Limit -}} -{{- if ge $limit 1 -}} -{{- $pages = $pages | first $limit -}} -{{- end -}} -{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} -<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> - <channel> - <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> - <link>{{ .Permalink }}</link> - <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> - {{- with $.Site.Params.images }} - <image> - <url>{{ index . 0 | absURL }}</url> - <link>{{ index . 0 | absURL }}</link> - </image> - {{- end }} - <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} - <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} - <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} - <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} - <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} - <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} - {{- with .OutputFormats.Get "RSS" -}} - {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} - {{- end -}} - {{ range $pages }} - {{- if and (ne .Layout `search`) (ne .Layout `archives`) }} - <item> - <title>{{ .Title }}</title> - <link>{{ .Permalink }}</link> - <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> - {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} - <guid>{{ .Permalink }}</guid> - <description>{{ .Content | html }}</description> - </item> - {{- end }} - {{ end }} - </channel> -</rss> diff --git a/layouts/_default/single.html b/layouts/_default/single.html @@ -2,36 +2,34 @@ <article class="post-single"> <header class="post-header"> - {{- partial "breadcrumbs.html" . }} + {{ partial "breadcrumbs.html" . }} <h1 class="post-title"> {{ .Title }} - {{- if .Draft }}<div class="entry-isdraft"><sup>&nbsp;&nbsp;[draft]</sup></div>{{- end }} + {{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[draft]</span></sup>{{- end }} </h1> {{- if not (.Param "hideMeta") }} <div class="post-meta"> - {{- partial "post_meta.html" . -}} + {{- partial "post_meta.html" . -}} {{- partial "translation_list.html" . -}} {{- partial "edit_post.html" . -}} + {{- partial "post_canonical.html" . -}} </div> - {{- end}} + {{- end }} </header> - {{- $isHidden := .Params.cover.hidden | default .Site.Params.cover.hiddenInSingle | default .Site.Params.cover.hidden}} + {{- $isHidden := .Params.cover.hidden | default .Site.Params.cover.hiddenInSingle | default .Site.Params.cover.hidden }} {{- partial "cover.html" (dict "cxt" . "IsHome" false "isHidden" $isHidden) }} {{- if (.Param "ShowToc") }} - <div class="toc"> - <details {{if (.Param "TocOpen") }} open{{ end }}> - <summary accesskey="c" title="(Alt + C)"> - <div class="details">{{- i18n "toc" | default "Table of Contents" }}</div> - </summary> - <div class="inner"> - {{- partial "toc.html" . }} - </div> - </details> - </div> + {{- partial "toc.html" . }} {{- end }} + + {{- if .Content }} <div class="post-content"> + {{- if not (.Param "disableAnchoredHeadings") }} {{- partial "anchored_headings.html" .Content -}} + {{- else }}{{ .Content }}{{ end }} </div> + {{- end }} + <footer class="post-footer"> {{- if .Params.tags }} <ul class="post-tags"> @@ -41,28 +39,10 @@ </ul> {{- end }} {{- if (.Param "ShowPostNavLinks") }} - {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} - {{- if and (gt (len $pages) 1) (in $pages . ) }} - <nav class="paginav"> - {{- with $pages.Next . }} - <a class="prev" href="{{.Permalink}}"> - <span class="title">« {{ i18n "prev_page" }}</span> - <br> - <span>{{- .Name -}}</span> - </a> - {{- end}} - {{- with $pages.Prev . }} - <a class="next" href="{{.Permalink}}"> - <span class="title">{{ i18n "next_page" }} »</span> - <br> - <span>{{- .Name -}}</span> - </a> - {{- end}} - </nav> - {{- end }} + {{- partial "post_nav_links.html" . }} {{- end }} - {{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true) ) }} - {{- partial "share_icons.html" . }} + {{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true)) }} + {{- partial "share_icons.html" . -}} {{- end }} </footer> @@ -71,4 +51,4 @@ {{- end }} </article> -{{- end }}{{/* end main */}} +{{- end }}{{/* end main */}} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html @@ -1,42 +1,34 @@ +{{- if not (.Param "hideFooter") }} <footer class="footer"> - <span>Powered by <a href="https://gohugo.io/" rel="noopener noreferrer" target="_blank">Hugo</a></span> - <span>&middot;</span> - <span>Theme <a href="https://git.io/hugopapermod" rel="noopener" target="_blank">PaperMod</a></span> + <span> + Powered by + <a href="https://gohugo.io/" rel="noopener noreferrer" target="_blank">Hugo</a> & + <a href="https://git.io/hugopapermod" rel="noopener" target="_blank">PaperMod</a> + </span> <span>&middot;</span> <span><a href="{{ .Site.Params.xxCustomLegalLink }}">{{ .Site.Params.xxCustomLegalText }}</a></span> </footer> +{{- end }} + {{- if (not .Site.Params.disableScrollToTop) }} -<a href="#top" aria-label="go to top" title="Go to Top (Alt + G)"> - <button class="top-link" id="top-link" type="button" accesskey="g"> - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor"> - <path d="M12 6H0l6-6z" /> - </svg> - </button> +<a href="#top" aria-label="go to top" title="Go to Top (Alt + G)" class="top-link" id="top-link" accesskey="g"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor"> + <path d="M12 6H0l6-6z" /> + </svg> </a> {{- end }} -{{- partial "extend_footer.html" . -}} -{{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default .Params.disableHLJS ) }} -{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }} -{{- if not .Site.Params.assets.disableFingerprinting }} -{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }} -<script defer src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}" - onload="hljs.initHighlightingOnLoad();"></script> -{{- else}} -{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify }} -<script defer src="{{ $highlight.RelPermalink }}" onload="hljs.initHighlightingOnLoad();"></script> -{{- end}} -{{- end }} + +{{- partial "extend_footer.html" . }} + <script> - window.onload = function () { - if (localStorage.getItem("menu-scroll-position")) { - document.getElementById('menu').scrollLeft = localStorage.getItem("menu-scroll-position"); + let menu = document.getElementById('menu') + if (menu) { + menu.scrollLeft = localStorage.getItem("menu-scroll-position"); + menu.onscroll = function () { + localStorage.setItem("menu-scroll-position", menu.scrollLeft); } } - function menu_on_scroll() { - localStorage.setItem("menu-scroll-position", document.getElementById('menu').scrollLeft); - } - document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener("click", function (e) { e.preventDefault(); @@ -88,3 +80,53 @@ </script> {{- end }} + +{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (.Param "ShowCodeCopyButtons")) }} +<script> + document.querySelectorAll('pre > code').forEach((codeblock) => { + const container = codeblock.parentNode.parentNode; + + const copybutton = document.createElement('button'); + copybutton.classList.add('copy-code'); + copybutton.innerText = '{{- i18n "code_copy" | default "copy" }}'; + + function copyingDone() { + copybutton.innerText = '{{- i18n "code_copied" | default "copied!" }}'; + setTimeout(() => { + copybutton.innerText = '{{- i18n "code_copy" | default "copy" }}'; + }, 2000); + } + + copybutton.addEventListener('click', (cb) => { + if ('clipboard' in navigator) { + navigator.clipboard.writeText(codeblock.textContent); + copyingDone(); + return; + } + + const range = document.createRange(); + range.selectNodeContents(codeblock); + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + try { + document.execCommand('copy'); + copyingDone(); + } catch (e) { }; + selection.removeRange(range); + }); + + if (container.classList.contains("highlight")) { + container.appendChild(copybutton); + } else if (container.parentNode.firstChild == container) { + // td containing LineNos + } else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") { + // table containing LineNos and code + codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton); + } else { + // code blocks not having highlight as parent class + codeblock.parentNode.appendChild(copybutton); + } + }); +</script> +{{- end }} diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html @@ -1,17 +1,17 @@ -{{- $scratch := newScratch}} +{{- $scratch := newScratch }} {{- if not .Date.IsZero -}} -{{- $scratch.Add "meta" (slice (.Date | time.Format ":date_long")) }} -{{- end -}} +{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format ":date_long"))) }} +{{- end }} {{- if (.Param "ShowReadingTime") -}} -{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%s min" .ReadingTime))) }} -{{- end -}} - -{{ with (partial "author.html" . ) }} -{{ $scratch.Add "meta" (slice .)}} -{{end}} +{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime))) }} +{{- end }} -{{- with ($scratch.Get "meta")}} -{{- delimit . "&nbsp;·&nbsp;"}} +{{- with (partial "author.html" .) }} +{{- $scratch.Add "meta" (slice .) }} {{- end }} + +{{- with ($scratch.Get "meta") }} +{{- delimit . "&nbsp;·&nbsp;" -}} +{{- end -}} diff --git a/static/css/custom.css b/static/css/custom.css @@ -20,7 +20,7 @@ .teaserimage { width: 150px; height: 113px; - margin-right: 20px; + margin-right: 20px !important; } .teasertitle { margin-top: 0 !important; diff --git a/themes/PaperMod/.github/ISSUE_TEMPLATE/bug_report.md b/themes/PaperMod/.github/ISSUE_TEMPLATE/bug_report.md @@ -11,7 +11,7 @@ assignees: '' ## READ BEFORE OPENING ISSUES -Please fill the template below +Please fill the template below - **DO NOT** ask for instructions. - Use Discussions section if you need help - See project wiki https://github.com/adityatelange/hugo-PaperMod/wiki @@ -25,12 +25,12 @@ Please fill the template below - Device/Os: [e.g. Android 10] - Type: [e.g. Desktop/Mobile] - - Browser and version [e.g. Chrome 86.0]: - - Hugo Version [ >=0.74 expected]: - - Theme Version [e.g. v4.0, master, or commit-id ]: + - Browser and version [e.g. Chrome 86.0]: + - Hugo Version [ >=0.83.0 expected]: + - Theme Version [e.g. v4.0, master, or commit-id ]: **Steps to reproduce the behavior:** -<!-- +<!-- 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' diff --git a/themes/PaperMod/.github/ISSUE_TEMPLATE/config.yml b/themes/PaperMod/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: PaperMod Discussions + url: https://github.com/adityatelange/hugo-PaperMod/discussions + about: Please ask and answer questions/doubts here, do not open an issue for questions. diff --git a/themes/PaperMod/.github/ISSUE_TEMPLATE/new-blank-issue.md b/themes/PaperMod/.github/ISSUE_TEMPLATE/new-blank-issue.md @@ -0,0 +1,7 @@ +--- +name: New Blank Issue +about: Anything other than bug report +title: "" +labels: "" +assignees: "" +--- diff --git a/themes/PaperMod/.github/PULL_REQUEST_TEMPLATE.md b/themes/PaperMod/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,44 @@ +<!-- + +## READ BEFORE OPENING A PR + +Thank you for contributing to hugo-PaperMod! +Please fill out the following questions to make it easier for us to review your +changes. You do not need to check all the boxes below. + +**NOTE**: PaperMod does not have any external dependencies fetched from 3rd party +CDN servers. However we do have custom Head/Footer extender templates which you can use +to add those to your website. +https://github.com/adityatelange/hugo-PaperMod/wiki/FAQs#custom-head--footer + +--> + + +**What does this PR change? What problem does it solve?** + +<!-- +Describe the changes and their purpose here, as detailed as and if needed. + +Please do not add 2 unrelated changes in a single PR as it is difficult to track/revert those in future. +--> + + +**Was the change discussed in an issue or in the Discussions before?** + +<!-- +Link issues and relevant Discussions posts here. + +If this PR resolves an issue on GitHub, use "Closes #1234" so that the issue +is closed automatically when this PR is merged. +--> + + +## PR Checklist + +- [ ] This change adds/updates translations and I have used the [template present here](https://github.com/adityatelange/hugo-PaperMod/wiki/Translations#want-to-add-your-language-). +- [ ] I have enabled [maintainer edits for this PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork). +- [ ] I have verified that the code works as described/as intended. +- [ ] This change adds a Social Icon which has a permissive license to use it. +- [ ] This change **does not** include any CDN resources/links. +- [ ] This change **does not** include any unrelated scripts such as bash and python scripts. +- [ ] This change updates the overridden internal templates from HUGO's repository. diff --git a/themes/PaperMod/.github/workflows/build.yml b/themes/PaperMod/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: - name: Setup hugo uses: peaceiris/actions-hugo@v2 with: - hugo-version: 'latest' + hugo-version: '0.83.0' - name: Build run: hugo --buildDrafts --gc --verbose --minify diff --git a/themes/PaperMod/.github/workflows/gh-pages.yml b/themes/PaperMod/.github/workflows/gh-pages.yml @@ -30,7 +30,7 @@ jobs: - name: Setup hugo uses: peaceiris/actions-hugo@v2 with: - hugo-version: 'latest' + hugo-version: '0.83.0' - name: Build run: hugo --buildDrafts --gc --verbose --minify diff --git a/themes/PaperMod/README.md b/themes/PaperMod/README.md @@ -1,25 +1,26 @@ -# PaperMod | [Demo](https://adityatelange.github.io/hugo-PaperMod/) +<h1 align=center>Hugo PaperMod | <a href="https://adityatelange.github.io/hugo-PaperMod/" rel="nofollow">Demo</a></h1> -☄️ Fast | ☁️ Fluent | 🌙 Smooth | 📱 Responsive +<h4 align=center>☄️ Fast | ☁️ Fluent | 🌙 Smooth | 📱 Responsive</h4> +<br> -Hugo PaperMod is a theme based on [hugo-paper](https://github.com/nanxiaobei/hugo-paper). -The goal of this project is add more Features and customization to the og theme. +> Hugo PaperMod is a theme based on [hugo-paper](https://github.com/nanxiaobei/hugo-paper). +> The goal of this project is to add more features and customization to the og theme. -The [demo site](https://adityatelange.github.io/hugo-PaperMod/) includes a lot of documentation about Installation, Features with few more stuff. Make sure you visit it, to get the awesome hands-on experience and get known about the features ... +The [demo](https://adityatelange.github.io/hugo-PaperMod/) includes a lot of documentation about Installation, Features with a few more stuff. Make sure you visit it, to get an awesome hands-on experience and get to know about the features ... -ExampleSite can be found here: [exampleSite](https://github.com/adityatelange/hugo-PaperMod/tree/exampleSite). Demo is built up with exampleSite as source. +**ExampleSite** can be found here: [exampleSite](https://github.com/adityatelange/hugo-PaperMod/tree/exampleSite). Demo is built up with [exampleSite](https://github.com/adityatelange/hugo-PaperMod/tree/exampleSite) as source. -![Build GH-Pages](https://github.com/adityatelange/hugo-PaperMod/workflows/Build%20GH-Pages/badge.svg) -![GitHub](https://img.shields.io/github/license/adityatelange/hugo-PaperMod) -[![hugo-papermod](https://img.shields.io/badge/Hugo--Themes-@PaperMod-blue)](https://themes.gohugo.io/hugo-papermod/) +[![Minimum Hugo Version](https://img.shields.io/static/v1?label=min-HUGO-version&message=0.83.0&color=blue&logo=hugo)](https://github.com/gohugoio/hugo/releases/tag/v0.83.0) +[![Build GH-Pages](https://github.com/adityatelange/hugo-PaperMod/workflows/Build%20GH-Pages/badge.svg)](https://github.com/adityatelange/hugo-PaperMod/deployments/activity_log?environment=github-pages) +[![GitHub](https://img.shields.io/github/license/adityatelange/hugo-PaperMod)](https://github.com/adityatelange/hugo-PaperMod/blob/master/LICENSE) +[![hugo-papermod](https://img.shields.io/badge/Hugo--Themes-@PaperMod-blue)](https://themes.gohugo.io/themes/hugo-papermod/) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=adityatelange_hugo-PaperMod&metric=alert_status)](https://sonarcloud.io/dashboard?id=adityatelange_hugo-PaperMod) ![code-size](https://img.shields.io/github/languages/code-size/adityatelange/hugo-PaperMod) --- <p align="center"> - <kbd><img width=600px src="https://raw.githubusercontent.com/adityatelange/hugo-PaperMod/exampleSite/content/posts/papermod/papermod-features/images/homeinfo.jpg" alt="HomeInfo" /></kbd> - <kbd><img width=153px src="https://i.ibb.co/LNgGcrt/mobileview.png" alt="HomeInfo" /></kbd> + <kbd><img src="https://user-images.githubusercontent.com/21258296/114303440-bfc0ae80-9aeb-11eb-8cfa-48a4bb385a6d.png" alt="Mockup image" title="Mockup"/></kbd> </p> --- @@ -34,18 +35,19 @@ ExampleSite can be found here: [exampleSite](https://github.com/adityatelange/hu - Table of Content Generation (newer implementation). - Archive of posts. - Social Icons (home-info and profile-mode) -- Social-Media Share buttons on post. +- Social-Media Share buttons on posts. - Menu location indicator. - Multilingual support. (with language selector) - Taxonomies - Cover image for each post (with Responsive image support). - Light/Dark theme (automatic theme switch a/c to browser theme and theme-switch button). - SEO Friendly. -- Muliple Author support. +- Multiple Author support. - Search Page with Fuse.js - Other Posts suggestion below a post -- BreadCrumb Navigation -- No webpack, nodejs and other depedencies required to edit the theme. +- Breadcrumb Navigation +- Code Block Copy buttons +- No webpack, nodejs and other dependencies are required to edit the theme. Read Wiki For More Details => **[PaperMod - Features](https://github.com/adityatelange/hugo-PaperMod/wiki/Features)** @@ -75,7 +77,7 @@ Release ChangeLog has info about stuff added: **[Releases](https://github.com/ad --- -## [LightHouse Report (100% ?)](https://lighthouse-dot-webdotdevsite.appspot.com//lh/html?url=https%3A%2F%2Fadityatelange.github.io%2Fhugo-PaperMod%2F) +## [Pagespeed Insights (100% ?)](https://pagespeed.web.dev/report?url=https://adityatelange.github.io/hugo-PaperMod/) --- @@ -84,4 +86,5 @@ Release ChangeLog has info about stuff added: **[Releases](https://github.com/ad - [**Highlight.js**](https://github.com/highlightjs/highlight.js) - [**Fuse.js**](https://github.com/krisk/fuse) - [**Feather Icons**](https://github.com/feathericons/feather) +- [**Simple Icons**](https://github.com/simple-icons/simple-icons) - **All Contributors and Supporters** diff --git a/themes/PaperMod/assets/css/404.css b/themes/PaperMod/assets/css/404.css @@ -1,11 +0,0 @@ -.not-found { - position: absolute; - left: 0; - right: 0; - display: flex; - align-items: center; - justify-content: center; - height: 80%; - font-size: 160px; - font-weight: 700 -} diff --git a/themes/PaperMod/assets/css/an-old-hope.min.css b/themes/PaperMod/assets/css/an-old-hope.min.css @@ -1,63 +0,0 @@ -.hljs-comment, -.hljs-quote { - color: #b6b18b -} - -.hljs-deletion, -.hljs-name, -.hljs-regexp, -.hljs-selector-class, -.hljs-selector-id, -.hljs-tag, -.hljs-template-variable, -.hljs-variable { - color: #eb3c54 -} - -.hljs-built_in, -.hljs-builtin-name, -.hljs-link, -.hljs-literal, -.hljs-meta, -.hljs-number, -.hljs-params, -.hljs-type { - color: #e7ce56 -} - -.hljs-attribute { - color: #ee7c2b -} - -.hljs-addition, -.hljs-bullet, -.hljs-string, -.hljs-symbol { - color: #4fb4d7 -} - -.hljs-section, -.hljs-title { - color: #78bb65 -} - -.hljs-keyword, -.hljs-selector-tag { - color: #b45ea4 -} - -.hljs { - display: block; - overflow-x: auto; - background: #1c1d21; - color: #c0c5ce; - padding: .5em -} - -.hljs-emphasis { - font-style: italic -} - -.hljs-strong { - font-weight: 700 -}- \ No newline at end of file diff --git a/themes/PaperMod/assets/css/archive.css b/themes/PaperMod/assets/css/archive.css @@ -1,44 +0,0 @@ -.archive-posts { - width: 100%; - font-size: 16px -} - -.archive-year { - margin-top: 40px -} - -.archive-year:not(:last-of-type) { - border-bottom: 2px solid var(--border) -} - -.archive-month { - display: flex; - align-items: flex-start; - padding: 10px 0 -} - -.archive-month-header { - margin: 25px 0; - width: 200px -} - -.archive-month:not(:last-of-type) { - border-bottom: 1px solid var(--border) -} - -.archive-entry { - position: relative; - padding: 5px; - margin: 10px 0 -} - -.archive-entry-title { - margin: 5px 0; - font-weight: 400 -} - -.archive-count, -.archive-meta { - color: var(--secondary); - font-size: 14px -} diff --git a/themes/PaperMod/assets/css/common/404.css b/themes/PaperMod/assets/css/common/404.css @@ -0,0 +1,11 @@ +.not-found { + position: absolute; + left: 0; + right: 0; + display: flex; + align-items: center; + justify-content: center; + height: 80%; + font-size: 160px; + font-weight: 700; +} diff --git a/themes/PaperMod/assets/css/common/archive.css b/themes/PaperMod/assets/css/common/archive.css @@ -0,0 +1,44 @@ +.archive-posts { + width: 100%; + font-size: 16px; +} + +.archive-year { + margin-top: 40px; +} + +.archive-year:not(:last-of-type) { + border-bottom: 2px solid var(--border); +} + +.archive-month { + display: flex; + align-items: flex-start; + padding: 10px 0; +} + +.archive-month-header { + margin: 25px 0; + width: 200px; +} + +.archive-month:not(:last-of-type) { + border-bottom: 1px solid var(--border); +} + +.archive-entry { + position: relative; + padding: 5px; + margin: 10px 0; +} + +.archive-entry-title { + margin: 5px 0; + font-weight: 400; +} + +.archive-count, +.archive-meta { + color: var(--secondary); + font-size: 14px; +} diff --git a/themes/PaperMod/assets/css/common/footer.css b/themes/PaperMod/assets/css/common/footer.css @@ -0,0 +1,60 @@ +.footer, +.top-link { + font-size: 12px; + color: var(--secondary); +} + +.footer { + max-width: calc(var(--main-width) + var(--gap) * 2); + margin: auto; + padding: calc((var(--footer-height) - var(--gap)) / 2) var(--gap); + text-align: center; + line-height: 24px; +} + +.footer span { + margin-inline-start: 1px; + margin-inline-end: 1px; +} + +.footer span:last-child { + white-space: nowrap; +} + +.footer a { + color: inherit; + border-bottom: 1px solid var(--secondary); +} + +.footer a:hover { + border-bottom: 1px solid var(--primary); +} + +.top-link { + visibility: hidden; + position: fixed; + bottom: 60px; + right: 30px; + z-index: 99; + background: var(--tertiary); + width: 42px; + height: 42px; + padding: 12px; + border-radius: 64px; + transition: visibility 0.5s, opacity 0.8s linear; +} + +.top-link, +.top-link svg { + filter: drop-shadow(0px 0px 0px var(--theme)); +} + +.footer a:hover, +.top-link:hover { + color: var(--primary); +} + +.top-link:focus, +#theme-toggle:focus { + outline: 0; +} diff --git a/themes/PaperMod/assets/css/common/header.css b/themes/PaperMod/assets/css/common/header.css @@ -0,0 +1,97 @@ +.nav { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + max-width: calc(var(--nav-width) + var(--gap) * 2); + margin-inline-start: auto; + margin-inline-end: auto; + line-height: var(--header-height); +} + +.nav a { + display: block; +} + +.logo, +#menu { + display: flex; + margin: auto var(--gap); +} + +.logo { + flex-wrap: inherit; +} + +.logo a { + font-size: 24px; + font-weight: 700; +} + +.logo a img { + display: inline; + vertical-align: middle; + pointer-events: none; + transform: translate(0, -10%); + border-radius: 6px; + margin-inline-end: 8px; +} + +#theme-toggle svg { + height: 18px; +} + +button#theme-toggle { + font-size: 26px; + margin: auto 4px; +} + +body.dark #moon { + vertical-align: middle; + display: none; +} + +body:not(.dark) #sun { + display: none; +} + +#menu { + list-style: none; + word-break: keep-all; + overflow-x: auto; + white-space: nowrap; +} + +#menu li + li { + margin-inline-start: var(--gap); +} + +#menu a { + font-size: 16px; +} + +#menu .active { + font-weight: 500; + border-bottom: 2px solid currentColor; +} + +.lang-switch li, +.lang-switch ul, +.logo-switches { + display: inline-flex; + margin: auto 4px; +} + +.lang-switch { + display: flex; + flex-wrap: inherit; +} + +.lang-switch a { + margin: auto 3px; + font-size: 16px; + font-weight: 500; +} + +.logo-switches { + flex-wrap: inherit; +} diff --git a/themes/PaperMod/assets/css/common/main.css b/themes/PaperMod/assets/css/common/main.css @@ -0,0 +1,68 @@ +.main { + position: relative; + min-height: calc(100vh - var(--header-height) - var(--footer-height)); + max-width: calc(var(--main-width) + var(--gap) * 2); + margin: auto; + padding: var(--gap); +} + +.page-header h1 { + font-size: 40px; +} + +.pagination { + display: flex; +} + +.pagination a { + color: var(--theme); + font-size: 13px; + line-height: 36px; + background: var(--primary); + border-radius: calc(36px / 2); + padding: 0 16px; +} + +.pagination .next { + margin-inline-start: auto; +} + +.social-icons { + padding: 12px 0; +} + +.social-icons a:not(:last-of-type) { + margin-inline-end: 12px; +} + +.social-icons a svg { + height: 26px; + width: 26px; +} + +code { + direction: ltr; +} + +div.highlight, +pre { + position: relative; +} + +.copy-code { + display: none; + position: absolute; + top: 4px; + right: 4px; + color: rgba(255, 255, 255, 0.8); + background: rgba(78, 78, 78, 0.8); + border-radius: var(--radius); + padding: 0 5px; + font-size: 14px; + user-select: none; +} + +div.highlight:hover .copy-code, +pre:hover .copy-code { + display: block; +} diff --git a/themes/PaperMod/assets/css/common/post-entry.css b/themes/PaperMod/assets/css/common/post-entry.css @@ -0,0 +1,104 @@ +.first-entry { + position: relative; + display: flex; + flex-direction: column; + justify-content: center; + min-height: 320px; + margin: var(--gap) 0 calc(var(--gap) * 2) 0; +} + +.first-entry .entry-header { + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; +} + +.first-entry .entry-header h1 { + font-size: 34px; + line-height: 1.3; +} + +.first-entry .entry-content { + margin: 14px 0; + font-size: 16px; + -webkit-line-clamp: 3; +} + +.first-entry .entry-footer { + font-size: 14px; +} + +.home-info .entry-content { + -webkit-line-clamp: unset; +} + +.post-entry { + position: relative; + margin-bottom: var(--gap); + padding: var(--gap); + background: var(--entry); + border-radius: var(--radius); + transition: transform 0.1s; + border: 1px solid var(--border); +} + +.post-entry:active { + transform: scale(0.96); +} + +.tag-entry .entry-cover { + display: none; +} + +.entry-header h2 { + font-size: 24px; + line-height: 1.3; +} + +.entry-content { + margin: 8px 0; + color: var(--secondary); + font-size: 14px; + line-height: 1.6; + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.entry-footer { + color: var(--secondary); + font-size: 13px; +} + +.entry-link { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; +} + +.entry-cover, +.entry-isdraft { + font-size: 14px; + color: var(--secondary); +} + +.entry-cover { + margin-bottom: var(--gap); + text-align: center; +} + +.entry-cover img { + border-radius: var(--radius); + pointer-events: none; + width: 100%; + height: auto; +} + +.entry-cover a { + color: var(--secondary); + box-shadow: 0 1px 0 var(--primary); +} diff --git a/themes/PaperMod/assets/css/common/post-single.css b/themes/PaperMod/assets/css/common/post-single.css @@ -0,0 +1,430 @@ +.page-header, +.post-header { + margin: 24px auto var(--content-gap) auto; +} + +.post-title { + margin-bottom: 2px; + font-size: 40px; +} + +.post-description { + margin-top: 10px; + margin-bottom: 5px; +} + +.post-meta, +.breadcrumbs { + color: var(--secondary); + font-size: 14px; + display: flex; + flex-wrap: wrap; +} + +.post-meta .i18n_list li { + display: inline-flex; + list-style: none; + margin: auto 3px; + box-shadow: 0 1px 0 var(--secondary); +} + +.breadcrumbs a { + font-size: 16px; +} + +.post-content { + color: var(--content); +} + +.post-content h3, +.post-content h4, +.post-content h5, +.post-content h6 { + margin: 24px 0 16px; +} + +.post-content h1 { + margin: 40px auto 32px; + font-size: 40px; +} + +.post-content h2 { + margin: 32px auto 24px; + font-size: 32px; +} + +.post-content h3 { + font-size: 24px; +} + +.post-content h4 { + font-size: 16px; +} + +.post-content h5 { + font-size: 14px; +} + +.post-content h6 { + font-size: 12px; +} + +.post-content a, +.toc a:hover { + box-shadow: 0 1px 0; +} + +.post-content a code { + margin: auto 0; + border-radius: 0; + box-shadow: 0 -1px 0 var(--primary) inset; +} + +.post-content del { + text-decoration: none; + background: linear-gradient(to right, var(--primary) 100%, transparent 0) 0 50%/1px 1px repeat-x; +} + +.post-content dl, +.post-content ol, +.post-content p, +.post-content figure, +.post-content ul { + margin-bottom: var(--content-gap); +} + +.post-content ol, +.post-content ul { + padding-inline-start: 20px; +} + +.post-content li { + margin-top: 5px; +} + +.post-content li p { + margin-bottom: 0; +} + +.post-content dl { + display: flex; + flex-wrap: wrap; + margin: 0; +} + +.post-content dt { + width: 25%; + font-weight: 700; +} + +.post-content dd { + width: 75%; + margin-inline-start: 0; + padding-inline-start: 10px; +} + +.post-content dd ~ dd, +.post-content dt ~ dt { + margin-top: 10px; +} + +.post-content table { + margin-bottom: 32px; +} + +.post-content table th, +.post-content table:not(.highlighttable, .highlight table, .gist .highlight) td { + min-width: 80px; + padding: 12px 8px; + line-height: 1.5; + border-bottom: 1px solid var(--border); +} + +.post-content table th { + font-size: 14px; + text-align: start; +} + +.post-content table:not(.highlighttable) td code:only-child { + margin: auto 0; +} + +.post-content .highlight table { + border-radius: var(--radius); +} + +.post-content .highlight:not(table), +.post-content pre { + margin: 10px auto; + background: var(--hljs-bg) !important; + border-radius: var(--radius); +} + +.post-content li > .highlight { + margin-inline-end: 0; +} + +.post-content ul pre { + margin-inline-start: calc(var(--gap) * -2); +} + +.post-content .highlight pre { + margin: 0; +} + +.post-content .highlighttable { + table-layout: fixed; +} + +.post-content .highlighttable td:first-child { + width: 40px; +} + +.post-content .highlighttable td .linenodiv { + padding-inline-end: 0 !important; +} + +.post-content .highlighttable td .highlight, +.post-content .highlighttable td .linenodiv pre { + margin-bottom: 0; +} + +.post-content .highlighttable td .highlight pre code::-webkit-scrollbar { + display: none; +} + +.post-content code { + margin: auto 4px; + padding: 4px 6px; + font-size: 0.78em; + line-height: 1.5; + background: var(--code-bg); + border-radius: 2px; +} + +.post-content pre code { + display: block; + margin: auto 0; + padding: 10px; + color: rgb(213, 213, 214); + background: 0 0; + border-radius: 0; + overflow-x: auto; + word-break: break-all; +} + +.post-content blockquote { + margin: 20px 0; + padding: 0 14px; + border-inline-start: 3px solid var(--primary); +} + +.post-content hr { + margin: 30px 0; + height: 2px; + background: var(--tertiary); + border-top: 0; + border-bottom: 0; +} + +.post-content iframe { + max-width: 100%; +} + +.post-content img { + border-radius: 4px; + margin: 1rem 0; +} + +.post-content img[src*="#center"] { + margin: 1rem auto; +} + +.post-content figure.align-center { + text-align: center; +} + +.post-content figure > figcaption { + color: var(--primary); + font-size: 16px; + font-weight: bold; + margin: 8px 0 16px; +} + +.post-content figure > figcaption > p { + color: var(--secondary); + font-size: 14px; + font-weight: normal; +} + +.toc { + margin: 0 2px 40px 2px; + border: 1px solid var(--border); + background: var(--code-bg); + border-radius: var(--radius); + padding: 0.4em; +} + +.dark .toc { + background: var(--entry); +} + +.toc details summary { + cursor: zoom-in; + margin-inline-start: 20px; +} + +.toc details[open] summary { + cursor: zoom-out; +} + +.toc .details { + display: inline; + font-weight: 500; +} + +.toc .inner { + margin: 0 20px; + padding: 10px 20px; +} + +.toc li ul { + margin-inline-start: var(--gap); +} + +.toc summary:focus { + outline: 0; +} + +.post-footer { + margin-top: 56px; +} + +.post-tags li { + display: inline-block; + margin-inline-end: 3px; + margin-bottom: 5px; +} + +.post-tags a, +.share-buttons, +.paginav { + border-radius: var(--radius); + background: var(--code-bg); + border: 1px solid var(--border); +} + +.post-tags a { + display: block; + padding-inline-start: 14px; + padding-inline-end: 14px; + color: var(--secondary); + font-size: 14px; + line-height: 34px; + background: var(--code-bg); +} + +.post-tags a:hover, +.paginav a:hover { + background: var(--border); +} + +.share-buttons { + margin: 14px 0; + padding-inline-start: var(--radius); + display: flex; + justify-content: center; + overflow-x: auto; +} + +.share-buttons a { + margin-top: 10px; +} + +.share-buttons a:not(:last-of-type) { + margin-inline-end: 12px; +} + +.share-buttons a svg { + height: 30px; + width: 30px; + fill: currentColor; + transition: transform 0.1s; +} + +.share-buttons svg:active { + transform: scale(0.96); +} + +h1:hover .anchor, +h2:hover .anchor, +h3:hover .anchor, +h4:hover .anchor, +h5:hover .anchor, +h6:hover .anchor { + display: inline-flex; + color: var(--secondary); + margin-inline-start: 8px; + font-weight: 500; + user-select: none; +} + +.post-content :not(table) ::-webkit-scrollbar-thumb { + border: 2px solid var(--hljs-bg); + background: rgb(113, 113, 117); +} + +.post-content :not(table) ::-webkit-scrollbar-thumb:hover { + background: rgb(163, 163, 165); +} + +.gist table::-webkit-scrollbar-thumb { + border: 2px solid rgb(255, 255, 255); + background: rgb(173, 173, 173); +} + +.gist table::-webkit-scrollbar-thumb:hover { + background: rgb(112, 112, 112); +} + +.post-content table::-webkit-scrollbar-thumb { + border-width: 2px; +} + +.paginav { + margin: 10px 0; + display: flex; + line-height: 30px; + border-radius: var(--radius); +} + +.paginav a { + padding-inline-start: 14px; + padding-inline-end: 14px; + border-radius: var(--radius); +} + +.paginav .title { + letter-spacing: 1px; + text-transform: uppercase; + font-size: small; + color: var(--secondary); +} + +.paginav .prev, +.paginav .next { + width: 50%; +} + +.paginav span:hover:not(.title) { + box-shadow: 0 1px 0; +} + +.paginav .next { + margin-inline-start: auto; + text-align: right; +} + +[dir="rtl"] .paginav .next { + text-align: left; +} diff --git a/themes/PaperMod/assets/css/common/profile-mode.css b/themes/PaperMod/assets/css/common/profile-mode.css @@ -0,0 +1,43 @@ +.buttons, +.main .profile { + display: flex; + justify-content: center; +} + +.main .profile { + align-items: center; + min-height: calc(100vh - var(--header-height) - var(--footer-height) - (var(--gap) * 2)); + text-align: center; +} + +.profile .profile_inner h1 { + padding: 12px 0; +} + +.profile img { + display: inline-table; + border-radius: 50%; + pointer-events: none; +} + +.buttons { + flex-wrap: wrap; + max-width: 400px; + margin: 0 auto; +} + +.button { + background: var(--tertiary); + border-radius: var(--radius); + margin: 8px; + padding: 6px; + transition: transform 0.1s; +} + +.button-inner { + padding: 0 8px; +} + +.button:active { + transform: scale(0.96); +} diff --git a/themes/PaperMod/assets/css/common/search.css b/themes/PaperMod/assets/css/common/search.css @@ -0,0 +1,45 @@ +#searchbox input { + padding: 4px 10px; + width: 100%; + color: var(--primary); + font-weight: bold; + border: 2px solid var(--tertiary); + border-radius: var(--radius); +} + +#searchbox input:focus { + border-color: var(--secondary); +} + +#searchResults li { + list-style: none; + border-radius: var(--radius); + padding: 10px; + margin: 10px 0; + position: relative; + font-weight: 500; +} + +#searchResults { + margin: 10px 0; + width: 100%; +} + +#searchResults li:active { + transition: transform 0.1s; + transform: scale(0.98); +} + +#searchResults a { + position: absolute; + width: 100%; + height: 100%; + top: 0px; + left: 0px; + outline: none; +} + +#searchResults .focus { + transform: scale(0.98); + border: 2px solid var(--tertiary); +} diff --git a/themes/PaperMod/assets/css/common/terms.css b/themes/PaperMod/assets/css/common/terms.css @@ -0,0 +1,18 @@ +.terms-tags li { + display: inline-block; + margin: 10px; + font-weight: 500; +} + +.terms-tags a { + display: block; + padding: 3px 10px; + background: var(--tertiary); + border-radius: 6px; + transition: transform 0.1s; +} + +.terms-tags a:active { + background: var(--tertiary); + transform: scale(0.96); +} diff --git a/themes/PaperMod/assets/css/core/reset.css b/themes/PaperMod/assets/css/core/reset.css @@ -0,0 +1,138 @@ +*, +::after, +::before { + box-sizing: border-box; +} + +html { + -webkit-tap-highlight-color: transparent; + overflow-y: scroll; +} + +a, +button, +body, +h1, +h2, +h3, +h4, +h5, +h6 { + color: var(--primary); +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; + font-size: 18px; + line-height: 1.6; + word-break: break-word; + background: var(--theme); +} + +article, +aside, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +table { + display: block; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + line-height: 1.2; +} + +h1, +h2, +h3, +h4, +h5, +h6, +p { + margin-top: 0; + margin-bottom: 0; +} + +ul { + padding: 0; +} + +a { + text-decoration: none; +} + +body, +figure, +ul { + margin: 0; +} + +table { + width: 100%; + border-collapse: collapse; + border-spacing: 0; + overflow-x: auto; + word-break: keep-all; +} + +button, +input, +textarea { + padding: 0; + font: inherit; + background: 0 0; + border: 0; +} + +input, +textarea { + outline: 0; +} + +button, +input[type=button], +input[type=submit] { + cursor: pointer; +} + +input:-webkit-autofill, +textarea:-webkit-autofill { + box-shadow: 0 0 0 50px var(--theme) inset; +} + +img { + display: block; + max-width: 100%; +} + +::-webkit-scrollbar-track { + background: 0 0; +} + +.list:not(.dark)::-webkit-scrollbar-track { + background: var(--code-bg); +} + +::-webkit-scrollbar-thumb { + background: var(--tertiary); + border: 5px solid var(--theme); + border-radius: var(--radius); +} + +.list:not(.dark)::-webkit-scrollbar-thumb { + border: 5px solid var(--code-bg); +} + +::-webkit-scrollbar-thumb:hover { + background: var(--secondary); +} diff --git a/themes/PaperMod/assets/css/core/theme-vars.css b/themes/PaperMod/assets/css/core/theme-vars.css @@ -0,0 +1,38 @@ +:root { + --gap: 24px; + --content-gap: 20px; + --nav-width: 1024px; + --main-width: 720px; + --header-height: 60px; + --footer-height: 60px; + --radius: 8px; + --theme: rgb(255, 255, 255); + --entry: rgb(255, 255, 255); + --primary: rgb(30, 30, 30); + --secondary: rgb(108, 108, 108); + --tertiary: rgb(214, 214, 214); + --content: rgb(31, 31, 31); + --hljs-bg: rgb(28, 29, 33); + --code-bg: rgb(245, 245, 245); + --border: rgb(238, 238, 238); +} + +.dark { + --theme: rgb(29, 30, 32); + --entry: rgb(46, 46, 51); + --primary: rgb(218, 218, 219); + --secondary: rgb(155, 156, 157); + --tertiary: rgb(65, 66, 68); + --content: rgb(196, 196, 197); + --hljs-bg: rgb(46, 46, 51); + --code-bg: rgb(55, 56, 62); + --border: rgb(51, 51, 51); +} + +.list { + background: var(--code-bg); +} + +.dark.list { + background: var(--theme); +} diff --git a/themes/PaperMod/assets/css/core/zmedia.css b/themes/PaperMod/assets/css/core/zmedia.css @@ -0,0 +1,58 @@ +@media screen and (max-width: 768px) { + /* theme-vars */ + :root { + --gap: 14px; + } + + /* profile-mode */ + .profile img { + transform: scale(0.85); + } + + /* post-entry */ + .first-entry { + min-height: 260px; + } + + /* archive */ + .archive-month { + flex-direction: column; + } + + .archive-year { + margin-top: 20px; + } + + /* footer */ + .footer { + padding: calc((var(--footer-height) - var(--gap) - 10px) / 2) var(--gap); + } +} + +@media screen and (min-width: 768px) { + /* reset */ + ::-webkit-scrollbar { + width: 19px; + height: 11px; + } +} + +/* footer */ +@media screen and (max-width: 900px) { + .list .top-link { + transform: translateY(-5rem); + } +} + +@media (prefers-reduced-motion) { + /* terms; profile-mode; post-single; post-entry; post-entry; search; search */ + .terms-tags a:active, + .button:active, + .share-buttons svg:active, + .post-entry:active, + .top-link, + #searchResults .focus, + #searchResults li:active { + transform: none; + } +} diff --git a/themes/PaperMod/assets/css/footer.css b/themes/PaperMod/assets/css/footer.css @@ -1,56 +0,0 @@ -.footer, -.top-link { - font-size: 12px; - color: var(--secondary) -} - -.footer { - max-width: calc(var(--main-width) + var(--gap) * 2); - margin: auto; - padding: calc((var(--footer-height) - var(--gap)) / 2) var(--gap); - text-align: center; - line-height: 24px -} - -.footer span { - margin-inline-start: 1px; - margin-inline-end: 1px -} - -.footer a { - color: inherit; - border-bottom: 1px solid var(--secondary) -} - -.footer a:hover { - border-bottom: 1px solid var(--primary) -} - -.top-link { - visibility: hidden; - position: fixed; - bottom: 60px; - right: 30px; - z-index: 99; - background: var(--tertiary); - width: 42px; - height: 42px; - padding: 12px; - border-radius: 64px; - transition: visibility .5s, opacity .8s linear -} - -.top-link, -.top-link svg { - filter: drop-shadow(0px 0px 0px var(--theme)); -} - -.footer a:hover, -.top-link:hover { - color: var(--primary) -} - -.top-link:focus, -#theme-toggle:focus { - outline: 0 -} diff --git a/themes/PaperMod/assets/css/header.css b/themes/PaperMod/assets/css/header.css @@ -1,97 +0,0 @@ -.nav { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - max-width: calc(var(--nav-width) + var(--gap) * 2); - margin-inline-start: auto; - margin-inline-end: auto; - line-height: var(--header-height) -} - -.nav a { - display: block -} - -.logo, -#menu { - display: flex; - margin: auto var(--gap); -} - -.logo { - flex-wrap: inherit -} - -.logo a { - font-size: 24px; - font-weight: 700; -} - -.logo a img { - display: inline; - vertical-align: middle; - pointer-events: none; - transform: translate(0, -10%); - border-radius: 6px; - margin-inline-end: 8px -} - -#theme-toggle svg { - height: 18px; -} - -button#theme-toggle { - font-size: 26px; - margin: auto 4px -} - -body.dark #moon { - vertical-align: middle; - display: none -} - -body:not(.dark) #sun { - display: none -} - -#menu { - list-style: none; - word-break: keep-all; - overflow-x: auto; - white-space: nowrap -} - -#menu li+li { - margin-inline-start: var(--gap) -} - -#menu a { - font-size: 16px -} - -#menu .active { - font-weight: 500; - border-bottom: 2px solid currentColor -} - -.lang-switch li, -.lang-switch ul, -.logo-switches { - display: inline-flex; - margin: auto 4px; -} - -.lang-switch { - display: flex; - flex-wrap: inherit -} - -.lang-switch a { - margin: auto 3px; - font-size: 16px; - font-weight: 500; -} - -.logo-switches { - flex-wrap: inherit -} diff --git a/themes/PaperMod/assets/css/hljs/an-old-hope.min.css b/themes/PaperMod/assets/css/hljs/an-old-hope.min.css @@ -0,0 +1,63 @@ +.hljs-comment, +.hljs-quote { + color: #b6b18b; +} + +.hljs-deletion, +.hljs-name, +.hljs-regexp, +.hljs-selector-class, +.hljs-selector-id, +.hljs-tag, +.hljs-template-variable, +.hljs-variable { + color: #eb3c54; +} + +.hljs-built_in, +.hljs-builtin-name, +.hljs-link, +.hljs-literal, +.hljs-meta, +.hljs-number, +.hljs-params, +.hljs-type { + color: #e7ce56; +} + +.hljs-attribute { + color: #ee7c2b; +} + +.hljs-addition, +.hljs-bullet, +.hljs-string, +.hljs-symbol { + color: #4fb4d7; +} + +.hljs-section, +.hljs-title { + color: #78bb65; +} + +.hljs-keyword, +.hljs-selector-tag { + color: #b45ea4; +} + +.hljs { + display: block; + overflow-x: auto; + background: #1c1d21; + color: #c0c5ce; + padding: .5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: 700; +} diff --git a/themes/PaperMod/assets/css/main.css b/themes/PaperMod/assets/css/main.css @@ -1,45 +0,0 @@ -.main { - position: relative; - min-height: calc(100vh - var(--header-height) - var(--footer-height)); - max-width: calc(var(--main-width) + var(--gap) * 2); - margin: auto; - padding: var(--gap) -} - -.page-header h1 { - font-size: 40px -} - -.pagination { - display: flex -} - -.pagination a { - color: var(--theme); - font-size: 13px; - line-height: 36px; - background: var(--primary); - border-radius: calc(36px / 2); - padding: 0 16px -} - -.pagination .next { - margin-inline-start: auto -} - -.social-icons { - padding: 12px 0 -} - -.social-icons a:not(:last-of-type) { - margin-inline-end: 12px -} - -.social-icons a svg { - height: 26px; - width: 26px -} - -code { - direction: ltr -} diff --git a/themes/PaperMod/assets/css/post-entry.css b/themes/PaperMod/assets/css/post-entry.css @@ -1,106 +0,0 @@ -.first-entry { - position: relative; - display: flex; - flex-direction: column; - justify-content: center; - min-height: 320px; - margin: var(--gap) 0 calc(var(--gap) * 2) 0 -} - -.first-entry .entry-header { - overflow: hidden; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 3 -} - -.first-entry .entry-header h1 { - font-size: 34px; - line-height: 1.3 -} - -.first-entry .entry-content { - margin: 14px 0; - font-size: 16px; - -webkit-line-clamp: 3 -} - -.first-entry .entry-footer { - font-size: 14px -} - -.home-info .entry-content { - -webkit-line-clamp: unset -} - -.post-entry { - position: relative; - margin-bottom: var(--gap); - padding: var(--gap); - background: var(--entry); - border-radius: var(--radius); - transition: transform .1s; - border: 1px solid var(--border); -} - -.post-entry:active { - transform: scale(.96) -} - -.tag-entry .entry-cover { - display: none -} - -.entry-header h2 { - font-size: 24px -} - -.entry-content { - margin: 8px 0; - color: var(--secondary); - font-size: 14px; - line-height: 1.6; - overflow: hidden; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2 -} - -.entry-footer { - color: var(--secondary); - font-size: 13px -} - -.entry-link { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0 -} - -.entry-cover, -.entry-isdraft { - font-size: 14px; - color: var(--secondary) -} - -.entry-isdraft { - display: inline -} - -.entry-cover { - margin-bottom: var(--gap); - text-align: center -} - -.entry-cover img { - border-radius: var(--radius); - pointer-events: none; - width: 100% -} - -.entry-cover a { - color: var(--secondary); - box-shadow: 0 1px 0 var(--primary) -} diff --git a/themes/PaperMod/assets/css/post-single.css b/themes/PaperMod/assets/css/post-single.css @@ -1,432 +0,0 @@ -.page-header, -.post-header { - margin: 24px auto var(--content-gap) auto -} - -.post-title { - margin-bottom: 2px; - font-size: 40px -} - -.post-description { - margin-top: 10px; - margin-bottom: 5px; -} - -.post-meta, -.breadcrumbs { - color: var(--secondary); - font-size: 14px; - display: flex; - flex-wrap: wrap -} - -.post-meta .i18n_list li { - display: inline-flex; - list-style: none; - margin: auto 3px; - box-shadow: 0 1px 0 var(--secondary) -} - -.breadcrumbs a { - font-size: 16px; -} - -.post-content { - color: var(--content) -} - -.post-content h3, -.post-content h4, -.post-content h5, -.post-content h6 { - margin: 24px 0 16px -} - -.post-content h1 { - margin: 40px auto 32px; - font-size: 40px -} - -.post-content h2 { - margin: 32px auto 24px; - font-size: 32px -} - -.post-content h3 { - font-size: 24px -} - -.post-content h4 { - font-size: 16px -} - -.post-content h5 { - font-size: 14px -} - -.post-content h6 { - font-size: 12px -} - -.post-content a, -.toc a:hover { - box-shadow: 0 1px 0 -} - -.post-content a code { - margin: auto 0; - border-radius: 0; - box-shadow: 0 -1px 0 var(--primary) inset -} - -.post-content del { - text-decoration: none; - background: linear-gradient(to right, var(--primary) 100%, transparent 0) 0 50%/1px 1px repeat-x -} - -.post-content dl, -.post-content ol, -.post-content p, -.post-content ul { - margin-bottom: var(--content-gap) -} - -.post-content ol, -.post-content ul { - padding-inline-start: 20px -} - -.post-content li { - margin-top: 5px -} - -.post-content li p { - margin-bottom: 0 -} - -.post-content dl { - display: flex; - flex-wrap: wrap; - margin: 0 -} - -.post-content dt { - width: 25%; - font-weight: 700 -} - -.post-content dd { - width: 75%; - margin-inline-start: 0; - padding-inline-start: 10px -} - -.post-content dd~dd, -.post-content dt~dt { - margin-top: 10px -} - -.post-content table { - margin-bottom: 32px -} - -.post-content table th, -.post-content table:not(.highlighttable, .highlight table, .gist .highlight) td { - min-width: 80px; - padding: 12px 8px; - line-height: 1.5; - border-bottom: 1px solid var(--border) -} - -.post-content table th { - font-size: 14px; - text-align: start -} - -.post-content table:not(.highlighttable) td code:only-child { - margin: auto 0 -} - -.post-content .highlight table { - border-radius: var(--radius) -} - -.post-content .highlight:not(table), -.post-content pre { - margin: 10px auto; - background: var(--hljs-bg) !important; - border-radius: var(--radius) -} - -.post-content li>.highlight { - margin-inline-end: 0 -} - -.post-content ul pre { - margin-inline-start: calc(var(--gap) * -2) -} - -.post-content .highlight pre { - margin: 0 -} - -.post-content .highlighttable { - table-layout: fixed -} - -.post-content .highlighttable td:first-child { - width: 40px -} - -.post-content .highlighttable td .linenodiv { - padding-inline-end: 0 !important -} - -.post-content .highlighttable td .highlight, -.post-content .highlighttable td .linenodiv pre { - margin-bottom: 0 -} - -.post-content .highlighttable td .highlight pre code::-webkit-scrollbar { - display: none -} - -.post-content .highlight span { - background: 0 0 !important -} - -.post-content code { - margin: auto 4px; - padding: 4px 6px; - font-family: Menlo, Monaco, 'Courier New', Courier, monospace; - font-size: .78em; - line-height: 1.5; - background: var(--code-bg); - border-radius: 2px -} - -.post-content pre code { - display: block; - margin: auto 0; - padding: 10px; - color: rgba(255, 255, 255, .8); - background: 0 0; - border-radius: 0; - overflow-x: auto; - word-break: break-all; -} - -.post-content blockquote { - margin: 20px 0; - padding: 0 14px; - border-inline-start: 3px solid var(--primary) -} - -.post-content hr { - margin: 30px 0; - height: 2px; - background: var(--tertiary); - border-top: 0; - border-bottom: 0 -} - -.post-content iframe { - max-width: 100% -} - -.post-content img { - border-radius: 4px -} - -.post-content img[src*='#center'] { - margin: auto -} - -.post-content figure.align-center { - text-align: center; -} - -.post-content figure>figcaption { - color: var(--primary); - font-size: 16px; - font-weight: bold; - margin: 8px 0 16px; -} - -.post-content figure>figcaption>p { - color: var(--secondary); - font-size: 14px; - font-weight: normal; -} - -.toc { - margin: 0 2px 40px 2px; - border: 1px solid var(--border); - background: var(--code-bg); - border-radius: var(--radius); - padding: .4em -} - -.dark .toc { - background: var(--entry); -} - -.toc details summary { - cursor: zoom-in; - margin-inline-start: 20px -} - -.toc details[open] summary { - cursor: zoom-out -} - -.toc .details { - display: inline; - font-weight: 500 -} - -.toc .inner { - margin: 0 20px; - padding: 10px 20px -} - -.toc li ul { - margin-inline-start: var(--gap) -} - -.toc summary:focus { - outline: 0 -} - -.post-footer { - margin-top: 56px -} - -.post-tags li { - display: inline-block; - margin-inline-end: 3px; - margin-bottom: 5px -} - -.post-tags a, -.share-buttons, -.paginav { - border-radius: var(--radius); - background: var(--code-bg); - border: 1px solid var(--border) -} - -.post-tags a { - display: block; - padding-inline-start: 14px; - padding-inline-end: 14px; - color: var(--secondary); - font-size: 14px; - line-height: 34px; - background: var(--code-bg) -} - -.post-tags a:hover, -.paginav a:hover { - background: var(--border) -} - -.share-buttons { - margin: 14px 0; - padding-inline-start: var(--radius); - display: flex; - justify-content: center; - overflow-x: auto -} - -.share-buttons a { - margin-top: 10px -} - -.share-buttons a:not(:last-of-type) { - margin-inline-end: 12px -} - -.share-buttons a svg { - height: 30px; - width: 30px; - fill: currentColor; - transition: transform .1s -} - -.share-buttons svg:active { - transform: scale(.96) -} - -h1:hover .anchor, -h2:hover .anchor, -h3:hover .anchor, -h4:hover .anchor, -h5:hover .anchor, -h6:hover .anchor { - display: inline-flex; - color: var(--secondary); - margin-inline-start: 8px; - font-weight: 500 -} - -.post-content :not(table) ::-webkit-scrollbar-thumb { - border: 2px solid var(--hljs-bg); - background: rgba(255, 255, 255, 0.32) -} - -.post-content :not(table) ::-webkit-scrollbar-thumb:hover { - background: rgba(255, 255, 255, 0.56) -} - -.gist table::-webkit-scrollbar-thumb { - border: 2px solid rgb(255, 255, 255); - background: rgba(0, 0, 0, 0.32) -} - -.gist table::-webkit-scrollbar-thumb:hover { - background: rgba(0, 0, 0, 0.56) -} - -.post-content table::-webkit-scrollbar-thumb { - border-width: 2px; -} - -.paginav { - margin: 10px 0; - display: flex; - line-height: 30px; - border-radius: var(--radius); -} - -.paginav a { - padding-inline-start: 14px; - padding-inline-end: 14px; - border-radius: var(--radius); -} - -.paginav .title { - letter-spacing: 1px; - text-transform: uppercase; - font-size: small; - color: var(--secondary); -} - -.paginav .prev, -.paginav .next { - width: 50%; -} - -.paginav span:hover:not(.title) { - box-shadow: 0 1px 0; -} - -.paginav .next { - margin-inline-start: auto; - text-align: right; -} - -[dir="rtl"] .paginav .next { - text-align: left; -}- \ No newline at end of file diff --git a/themes/PaperMod/assets/css/profile-mode.css b/themes/PaperMod/assets/css/profile-mode.css @@ -1,46 +0,0 @@ -.buttons, -.main .profile { - display: flex; - justify-content: center -} - -.main .profile { - position: absolute; - left: 0; - right: 0; - align-items: center; - height: 80%; - text-align: center -} - -.profile .profile_inner h1 { - padding: 12px 0 -} - -.profile img { - display: inline-table; - border-radius: 50%; - pointer-events: none -} - -.buttons { - flex-wrap: wrap; - max-width: 400px; - margin: 0 auto -} - -.button { - background: var(--tertiary); - border-radius: var(--radius); - margin: 8px; - padding: 6px; - transition: transform .1s -} - -.button-inner { - padding: 0 8px -} - -.button:active { - transform: scale(.96) -} diff --git a/themes/PaperMod/assets/css/reset.css b/themes/PaperMod/assets/css/reset.css @@ -1,138 +0,0 @@ -*, -::after, -::before { - box-sizing: border-box -} - -html { - -webkit-tap-highlight-color: transparent; - overflow-y: scroll; -} - -a, -button, -body, -h1, -h2, -h3, -h4, -h5, -h6 { - color: var(--primary) -} - -body { - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; - font-size: 18px; - line-height: 1.6; - word-break: break-word; - background: var(--theme) -} - -article, -aside, -figcaption, -figure, -footer, -header, -hgroup, -main, -nav, -section, -table { - display: block -} - -h1, -h2, -h3, -h4, -h5, -h6 { - line-height: 1.2 -} - -h1, -h2, -h3, -h4, -h5, -h6, -p { - margin-top: 0; - margin-bottom: 0 -} - -ul { - padding: 0 -} - -a { - text-decoration: none -} - -body, -figure, -ul { - margin: 0 -} - -table { - width: 100%; - border-collapse: collapse; - border-spacing: 0; - overflow-x: auto; - word-break: keep-all -} - -button, -input, -textarea { - padding: 0; - font: inherit; - background: 0 0; - border: 0; -} - -input, -textarea { - outline: 0 -} - -button, -input[type=button], -input[type=submit] { - cursor: pointer -} - -input:-webkit-autofill, -textarea:-webkit-autofill { - box-shadow: 0 0 0 50px var(--theme) inset -} - -img { - display: block; - max-width: 100% -} - -::-webkit-scrollbar-track { - background: 0 0 -} - -.list:not(.dark)::-webkit-scrollbar-track { - background: var(--code-bg) -} - -::-webkit-scrollbar-thumb { - background: var(--tertiary); - border: 5px solid var(--theme); - border-radius: var(--radius) -} - -.list:not(.dark)::-webkit-scrollbar-thumb { - border: 5px solid var(--code-bg) -} - -::-webkit-scrollbar-thumb:hover { - background: var(--secondary) -} diff --git a/themes/PaperMod/assets/css/search.css b/themes/PaperMod/assets/css/search.css @@ -1,45 +0,0 @@ -#searchbox input { - padding: 4px 10px; - width: 100%; - color: var(--primary); - font-weight: bold; - border: 2px solid var(--tertiary); - border-radius: var(--radius); -} - -#searchbox input:focus { - border-color: var(--secondary); -} - -#searchResults li { - list-style: none; - border-radius: var(--radius); - padding: 10px; - margin: 10px 0; - position: relative; - font-weight: 500; -} - -#searchResults { - margin: 10px 0; - width: 100%; -} - -#searchResults li:active { - transition: transform .1s; - transform: scale(.98); -} - -#searchResults a { - position: absolute; - width: 100%; - height: 100%; - top: 0px; - left: 0px; - outline: none; -} - -#searchResults .focus { - transform: scale(.98); - border: 2px solid var(--tertiary) -} diff --git a/themes/PaperMod/assets/css/terms.css b/themes/PaperMod/assets/css/terms.css @@ -1,18 +0,0 @@ -.terms-tags li { - display: inline-block; - margin: 10px; - font-weight: 500 -} - -.terms-tags a { - display: block; - padding: 3px 10px; - background: var(--tertiary); - border-radius: 6px; - transition: transform .1s -} - -.terms-tags a:active { - background: var(--tertiary); - transform: scale(.96) -} diff --git a/themes/PaperMod/assets/css/theme-vars.css b/themes/PaperMod/assets/css/theme-vars.css @@ -1,38 +0,0 @@ -:root { - --gap: 24px; - --content-gap: 20px; - --nav-width: 1024px; - --main-width: 720px; - --header-height: 60px; - --footer-height: 60px; - --radius: 8px; - --theme: #fff; - --entry: #fff; - --primary: rgba(0, 0, 0, 0.88); - --secondary: rgba(0, 0, 0, 0.56); - --tertiary: rgba(0, 0, 0, 0.16); - --content: rgba(0, 0, 0, 0.88); - --hljs-bg: #1c1d21; - --code-bg: #f5f5f5; - --border: #eee; -} - -.dark { - --theme: #1d1e20; - --entry: #2e2e33; - --primary: rgba(255, 255, 255, 0.84); - --secondary: rgba(255, 255, 255, 0.56); - --tertiary: rgba(255, 255, 255, 0.16); - --content: rgba(255, 255, 255, 0.74); - --hljs-bg: #2e2e33; - --code-bg: #37383e; - --border: #333; -} - -.list { - background: var(--code-bg); -} - -.dark.list { - background: var(--theme); -} diff --git a/themes/PaperMod/assets/css/zmedia.css b/themes/PaperMod/assets/css/zmedia.css @@ -1,53 +0,0 @@ -@media screen and (max-width: 768px) { - /* theme-vars */ - :root { - --gap: 14px; - } - - /* profile-mode */ - .profile img { - transform: scale(0.85); - } - - /* post-entry */ - .first-entry { - min-height: 260px; - } - - /* archive */ - .archive-month { - flex-direction: column; - } - - .archive-year { - margin-top: 20px; - } -} - -@media screen and (min-width: 768px) { - /* reset */ - ::-webkit-scrollbar { - width: 19px; - height: 11px; - } -} - -/* footer */ -@media screen and (max-width: 900px) { - .list .top-link { - transform: translateY(-5rem); - } -} - -@media (prefers-reduced-motion) { - /* terms; profile-mode; post-single; post-entry; post-entry; search; search */ - .terms-tags a:active, - .button:active, - .share-buttons svg:active, - .post-entry:active, - .top-link, - #searchResults .focus, - #searchResults li:active { - transform: none; - } -} diff --git a/themes/PaperMod/assets/js/fastsearch.js b/themes/PaperMod/assets/js/fastsearch.js @@ -1,11 +1,13 @@ +import * as params from '@params'; + var fuse; // holds our search engine var resList = document.getElementById('searchResults'); var sInput = document.getElementById('searchInput'); -var first, last = null +var first, last, current_elem = null var resultsAvailable = false; -// load our search index, only executed onload -function loadSearch() { +// load our search index +window.onload = function () { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { @@ -24,7 +26,21 @@ function loadSearch() { 'content' ] }; - {{ if . }}options = {{ jsonify . }}{{ end }} // load custom options from .Site.Params.fuseOpts + if (params.fuseOpts) { + options = { + isCaseSensitive: params.fuseOpts.iscasesensitive ? params.fuseOpts.iscasesensitive : false, + includeScore: params.fuseOpts.includescore ? params.fuseOpts.includescore : false, + includeMatches: params.fuseOpts.includematches ? params.fuseOpts.includematches : false, + minMatchCharLength: params.fuseOpts.minmatchcharlength ? params.fuseOpts.minmatchcharlength : 1, + shouldSort: params.fuseOpts.shouldsort ? params.fuseOpts.shouldsort : true, + findAllMatches: params.fuseOpts.findallmatches ? params.fuseOpts.findallmatches : false, + keys: params.fuseOpts.keys ? params.fuseOpts.keys : ['title', 'permalink', 'summary', 'content'], + location: params.fuseOpts.location ? params.fuseOpts.location : 0, + threshold: params.fuseOpts.threshold ? params.fuseOpts.threshold : 0.4, + distance: params.fuseOpts.distance ? params.fuseOpts.distance : 100, + ignoreLocation: params.fuseOpts.ignorelocation ? params.fuseOpts.ignorelocation : true + } + } fuse = new Fuse(data, options); // build the index from the json file } } else { @@ -36,13 +52,18 @@ function loadSearch() { xhr.send(); } - -function itemGen(name, link) { - return `<li class="post-entry"><header class="entry-header">${name}&nbsp;»</header><a href="${link}" aria-label="${name}"></a></li>` -} - -function activeToggle() { - document.activeElement.parentElement.classList.toggle("focus") +function activeToggle(ae) { + document.querySelectorAll('.focus').forEach(function (element) { + // rm focus class + element.classList.remove("focus") + }); + if (ae) { + ae.focus() + document.activeElement = current_elem = ae; + ae.parentElement.classList.add("focus") + } else { + document.activeElement.parentElement.classList.add("focus") + } } function reset() { @@ -55,23 +76,25 @@ function reset() { sInput.onkeyup = function (e) { // run a search query (for "term") every time a letter is typed // in the search box - const results = fuse.search(this.value.trim()); // the actual query being run using fuse.js + if (fuse) { + const results = fuse.search(this.value.trim()); // the actual query being run using fuse.js + if (results.length !== 0) { + // build our html if result exists + let resultSet = ''; // our results bucket - if (results.length !== 0) { - // build our html if result exists - let resultSet = ''; // our results bucket + for (let item in results) { + resultSet += `<li class="post-entry"><header class="entry-header">${results[item].item.title}&nbsp;»</header>` + + `<a href="${results[item].item.permalink}" aria-label="${results[item].item.title}"></a></li>` + } - for (let item in results) { - resultSet = resultSet + itemGen(results[item].item.title, results[item].item.permalink) + resList.innerHTML = resultSet; + resultsAvailable = true; + first = resList.firstChild; + last = resList.lastChild; + } else { + resultsAvailable = false; + resList.innerHTML = ''; } - - resList.innerHTML = resultSet; - resultsAvailable = true; - first = resList.firstChild; - last = resList.lastChild; - } else { - resultsAvailable = false; - resList.innerHTML = ''; } } @@ -83,7 +106,8 @@ sInput.addEventListener('search', function (e) { // kb bindings document.onkeydown = function (e) { let key = e.key; - let ae = document.activeElement; + var ae = document.activeElement; + let inbox = document.getElementById("searchbox").contains(ae) if (ae === sInput) { @@ -91,40 +115,33 @@ document.onkeydown = function (e) { while (elements.length > 0) { elements[0].classList.remove('focus'); } - } + } else if (current_elem) ae = current_elem; - if (key === "ArrowDown" && resultsAvailable && inbox) { + if (key === "Escape") { + reset() + } else if (!resultsAvailable || !inbox) { + return + } else if (key === "ArrowDown") { e.preventDefault(); if (ae == sInput) { // if the currently focused element is the search input, focus the <a> of first <li> - activeToggle(); // rm focus class - resList.firstChild.lastChild.focus(); - activeToggle(); // add focus class - } else if (ae.parentElement == last) { + activeToggle(resList.firstChild.lastChild); + } else if (ae.parentElement != last) { // if the currently focused element's parent is last, do nothing - } else { // otherwise select the next search result - activeToggle(); // rm focus class - ae.parentElement.nextSibling.lastChild.focus(); - activeToggle(); // add focus class + activeToggle(ae.parentElement.nextSibling.lastChild); } - } else if (key === "ArrowUp" && resultsAvailable && inbox) { + } else if (key === "ArrowUp") { e.preventDefault(); - if (ae == sInput) { - // if the currently focused element is input box, do nothing - } else if (ae.parentElement == first) { + if (ae.parentElement == first) { // if the currently focused element is first item, go to input box - activeToggle(); // rm focus class - sInput.focus(); - } else { + activeToggle(sInput); + } else if (ae != sInput) { + // if the currently focused element is input box, do nothing // otherwise select the previous search result - activeToggle(); // rm focus class - ae.parentElement.previousSibling.lastChild.focus(); - activeToggle(); // add focus class + activeToggle(ae.parentElement.previousSibling.lastChild); } - } else if (key === "ArrowRight" && resultsAvailable && inbox) { + } else if (key === "ArrowRight") { ae.click(); // click on active link - } else if (key === "Escape") { - reset() } } diff --git a/themes/PaperMod/i18n/bn.yaml b/themes/PaperMod/i18n/bn.yaml @@ -0,0 +1,28 @@ +- id: prev_page + translation: "পূর্বের পাতা" + +- id: next_page + translation: "পরবর্তী পাতা" + +- id: read_time + translation: + one : "১ মিনিট" + other: "{{ .Count }} মিনিট" + +- id: toc + translation: "সূচিপত্র" + +- id: translations + translation: "অনুবাদসমূহ" + +- id: home + translation: "হোম" + +- id: edit_post + translation: "সম্পাদনা করুন" + +- id: code_copy + translation: "কপি করুন" + +- id: code_copied + translation: "কপি হয়েছে!" diff --git a/themes/PaperMod/i18n/ckb.yaml b/themes/PaperMod/i18n/ckb.yaml @@ -0,0 +1,25 @@ +- id: prev_page + translation: "پەڕەی پێشتر" + +- id: next_page + translation: "پەڕەی دواتر" + +- id: read_time + translation: + one : "1 خولەک" + other: "{{ .Count }} خولەک" + +- id: toc + translation: "پێڕست" + +- id: translations + translation: "وەرگێڕانەکان" + +- id: home + translation: "ماڵەوە" + +- id: code_copy + translation: "لەبەری بگرەوە" + +- id: code_copied + translation: "لەبەر گیرایەوە!" diff --git a/themes/PaperMod/i18n/da.yaml b/themes/PaperMod/i18n/da.yaml @@ -0,0 +1,28 @@ +- id: prev_page + translation: "Forrige Side" + +- id: next_page + translation: "Næste Side" + +- id: read_time + translation: + one: "1 min" + other: "{{ .Count }} min" + +- id: toc + translation: "Indholdsfortegnelse" + +- id: translations + translation: "Oversættelser" + +- id: home + translation: "Start" + +- id: edit_post + translation: "Rediger" + +- id: code_copy + translation: "kopier" + +- id: code_copied + translation: "kopieret!" diff --git a/themes/PaperMod/i18n/en.yaml b/themes/PaperMod/i18n/en.yaml @@ -17,3 +17,9 @@ - id: home translation: "Home" + +- id: code_copy + translation: "copy" + +- id: code_copied + translation: "copied!" diff --git a/themes/PaperMod/i18n/eo.yaml b/themes/PaperMod/i18n/eo.yaml @@ -0,0 +1,25 @@ +- id: prev_page + translation: "antaŭa paĝo" + +- id: next_page + translation: "sekva paĝo" + +- id: read_time + translation: + one : "1 min" + other: "{{ .Count }} min" + +- id: toc + translation: "Enhavo" + +- id: translations + translation: "tradukoj" + +- id: home + translation: "ĉefpaĝo" + +- id: code_copy + translation: "kopii" + +- id: code_copied + translation: "kopiite!" diff --git a/themes/PaperMod/i18n/es.yaml b/themes/PaperMod/i18n/es.yaml @@ -14,3 +14,12 @@ - id: translations translation: "Traducciones" + +- id: home + translation: "Inicio" + +- id: code_copy + translation: "copiar" + +- id: code_copied + translation: "¡copiado!"+ \ No newline at end of file diff --git a/themes/PaperMod/i18n/fa.yaml b/themes/PaperMod/i18n/fa.yaml @@ -1,16 +1,28 @@ - id: prev_page - translation: "صفحهٔ قبل" + translation: "صفحه قبلی" - id: next_page - translation: "صفحهٔ بعد" + translation: "صفحه بعدی" - id: read_time translation: - one : "1 دقیقه" + one: "۱ دقیقه" other: "{{ .Count }} دقیقه" - id: toc translation: "فهرست مطالب" - id: translations - translation: "ترجمه‌ها" + translation: "ترجمه ها" + +- id: home + translation: "خانه" + +- id: edit_post + translation: "ویرایش" + +- id: code_copy + translation: "کپی" + +- id: code_copied + translation: "کپی شد!"+ \ No newline at end of file diff --git a/themes/PaperMod/i18n/fr.yaml b/themes/PaperMod/i18n/fr.yaml @@ -3,3 +3,26 @@ - id: next_page translation: "Page Suivante" + +- id: read_time + translation: + one : "1 min" + other: "{{ .Count }} min" + +- id: toc + translation: "Table des Matières" + +- id: translations + translation: "Traductions" + +- id: home + translation: "Accueil" + +- id: edit_post + translation: "Modifier" + +- id: code_copy + translation: "copier" + +- id: code_copied + translation: "copié!" diff --git a/themes/PaperMod/i18n/it.yaml b/themes/PaperMod/i18n/it.yaml @@ -14,3 +14,9 @@ - id: translations translation: "Traduzioni" + +- id: code_copy + translation: "copia" + +- id: code_copied + translation: "copiato!" diff --git a/themes/PaperMod/i18n/ko.yaml b/themes/PaperMod/i18n/ko.yaml @@ -3,3 +3,23 @@ - id: next_page translation: "다음 페이지" + +- id: read_time + translation: + one : "1 분" + other: "{{ .Count }} 분" + +- id: toc + translation: "목차" + +- id: translations + translation: "번역" + +- id: home + translation: "홈페이지" + +- id: code_copy + translation: "복사" + +- id: code_copied + translation: "복사완료!" diff --git a/themes/PaperMod/i18n/ku.yaml b/themes/PaperMod/i18n/ku.yaml @@ -0,0 +1,25 @@ +- id: prev_page + translation: "Rêpela Berê" + +- id: next_page + translation: "Rûpela Bê" + +- id: read_time + translation: + one : "1 xulek" + other: "{{ .Count }} xulek" + +- id: toc + translation: "Pêrist" + +- id: translations + translation: "Wergêranan" + +- id: home + translation: "Xanî" + +- id: code_copy + translation: "Jê bigre" + +- id: code_copied + translation: "Hat jê girtin!" diff --git a/themes/PaperMod/i18n/mn.yaml b/themes/PaperMod/i18n/mn.yaml @@ -0,0 +1,25 @@ +- id: prev_page + translation: "Ѳмнѳх" + +- id: next_page + translation: "Дараах" + +- id: read_time + translation: + one : "1 МИН" + other: "{{ .Count }} МИН" + +- id: toc + translation: "Агуулга" + +- id: translations + translation: "Орчуулга" + +- id: home + translation: "Нүүр" + +- id: code_copy + translation: "хуулах" + +- id: code_copied + translation: "хуулсан!" diff --git a/themes/PaperMod/i18n/nl.yaml b/themes/PaperMod/i18n/nl.yaml @@ -0,0 +1,28 @@ +- id: prev_page + translation: "Vorige" + +- id: next_page + translation: "Volgende" + +- id: read_time + translation: + one: "1 min" + other: "{{ .Count }} min" + +- id: toc + translation: "Inhoudsopgave" + +- id: translations + translation: "Vertalingen" + +- id: home + translation: "Startpagina" + +- id: edit_post + translation: "Bewerk" + +- id: code_copy + translation: "kopieer" + +- id: code_copied + translation: "gekopieerd!" diff --git a/themes/PaperMod/i18n/pl.yaml b/themes/PaperMod/i18n/pl.yaml @@ -0,0 +1,28 @@ +- id: prev_page + translation: "Poprzednia strona" + +- id: next_page + translation: "Następna strona" + +- id: read_time + translation: + one: "1 min" + other: "{{ .Count }} min" + +- id: toc + translation: "Spis treści" + +- id: translations + translation: "Tłumaczenia" + +- id: home + translation: "Strona Główna" + +- id: edit_post + translation: "Edytuj" + +- id: code_copy + translation: "Kopiuj" + +- id: code_copied + translation: "Skopiowano!" diff --git a/themes/PaperMod/i18n/ru.yaml b/themes/PaperMod/i18n/ru.yaml @@ -1,14 +1,23 @@ - id: prev_page - translation: 'Предыдущая' + translation: "Предыдущая" - id: next_page - translation: 'Следующая' + translation: "Следующая" - id: read_time - translation: '{{ .Count }} мин' + translation: "{{ .Count }} мин" - id: toc - translation: 'Оглавление' + translation: "Оглавление" - id: translations - translation: 'Переводы' + translation: "Переводы" + +- id: home + translation: "Главная" + +- id: code_copy + translation: "копировать" + +- id: code_copied + translation: "скопировано!"+ \ No newline at end of file diff --git a/themes/PaperMod/i18n/tr.yaml b/themes/PaperMod/i18n/tr.yaml @@ -0,0 +1,25 @@ +- id: prev_page + translation: "Önceki Sayfa" + +- id: next_page + translation: "Sonraki Sayfa" + +- id: read_time + translation: + one : "1 dk" + other: "{{ .Count }} dk" + +- id: toc + translation: "İçindekiler" + +- id: translations + translation: "Çeviriler" + +- id: home + translation: "Anasayfa" + +- id: code_copy + translation: "Kopyala" + +- id: code_copied + translation: "Kopyalandı!" diff --git a/themes/PaperMod/i18n/uk.yaml b/themes/PaperMod/i18n/uk.yaml @@ -0,0 +1,25 @@ +- id: prev_page + translation: "Попередня" + +- id: next_page + translation: "Наступна" + +- id: read_time + translation: + one : "1 хвилина" + other: "{{ .Count }} хвилин" + +- id: toc + translation: "Зміст" + +- id: translations + translation: "Переклади" + +- id: home + translation: "Головна" + +- id: code_copy + translation: "копіювати" + +- id: code_copied + translation: "скопійовано!"+ \ No newline at end of file diff --git a/themes/PaperMod/i18n/vi.yaml b/themes/PaperMod/i18n/vi.yaml @@ -0,0 +1,25 @@ +- id: prev_page + translation: "Trang trước" + +- id: next_page + translation: "Trang tiếp theo" + +- id: read_time + translation: + one : "1 phút" + other: "{{ .Count }} phút" + +- id: toc + translation: "Mục lục" + +- id: translations + translation: "Bản dịch" + +- id: home + translation: "Trang chủ" + +- id: code_copy + translation: "Sao chép" + +- id: code_copied + translation: "Đã sao chép!" diff --git a/themes/PaperMod/i18n/zh-tw.yaml b/themes/PaperMod/i18n/zh-tw.yaml @@ -0,0 +1,25 @@ +- id: prev_page + translation: "上一篇" + +- id: next_page + translation: "下一篇" + +- id: read_time + translation: + one : "1 分鐘" + other: "{{ .Count }} 分鐘" + +- id: toc + translation: "目錄" + +- id: translations + translation: "語言" + +- id: home + translation: "首頁" + +- id: code_copy + translation: "複製" + +- id: code_copied + translation: "已複製!" diff --git a/themes/PaperMod/i18n/zh.yaml b/themes/PaperMod/i18n/zh.yaml @@ -14,3 +14,12 @@ - id: translations translation: "语言" + +- id: home + translation: "主页" + +- id: code_copy + translation: "复制" + +- id: code_copied + translation: "已复制!" diff --git a/themes/PaperMod/layouts/404.html b/themes/PaperMod/layouts/404.html @@ -1,3 +1,3 @@ -{{ define "main" }} +{{- define "main" }} <div class="not-found">404</div> -{{ end }}{{/* end main */}}- \ No newline at end of file +{{- end }}{{/* end main */ -}} diff --git a/themes/PaperMod/layouts/_default/archives.html b/themes/PaperMod/layouts/_default/archives.html @@ -10,6 +10,11 @@ </header> {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} + +{{- if .Site.Params.ShowAllPagesInArchive }} +{{- $pages = site.RegularPages }} +{{- end }} + {{- range $pages.GroupByPublishDate "2006" }} {{- if ne .Key "0001" }} <div class="archive-year"> @@ -20,11 +25,12 @@ <div class="archive-month"> <h3 class="archive-month-header">{{- .Key }}<sup class="archive-count">&nbsp;&nbsp;{{ len .Pages }}</sup></h3> <div class="archive-posts"> - {{- range .Pages }} + {{- range .Pages }} {{- if eq .Kind "page" }} <div class="archive-entry"> <h3 class="archive-entry-title"> {{- .Title | markdownify }} + {{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[draft]</span></sup>{{- end }} </h3> <div class="archive-meta"> {{- partial "post_meta.html" . -}} @@ -40,4 +46,4 @@ {{- end }} {{- end }} -{{- end }}{{/* end main */}} +{{- end }}{{/* end main */}} diff --git a/themes/PaperMod/layouts/_default/baseof.html b/themes/PaperMod/layouts/_default/baseof.html @@ -13,12 +13,11 @@ {{- print " dark" }} {{- end -}} " id="top"> - {{- partialCached "header.html" . .Page}} + {{- partialCached "header.html" . .Page -}} <main class="main"> - {{- block "main" . }} - {{- end }} + {{- block "main" . }}{{ end }} </main> - {{- partialCached "footer.html" . .Type .Layout .Params }} + {{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}} </body> </html> diff --git a/themes/PaperMod/layouts/_default/list.html b/themes/PaperMod/layouts/_default/list.html @@ -10,25 +10,33 @@ <h1>{{ .Title }}</h1> {{- if .Description }} <div class="post-description"> - {{ .Description }} + {{ .Description | markdownify }} </div> {{- end }} </header> {{- end }} +{{- if .Content }} +<div class="post-content"> + {{- if not (.Param "disableAnchoredHeadings") }} + {{- partial "anchored_headings.html" .Content -}} + {{- else }}{{ .Content }}{{ end }} +</div> +{{- end }} + {{- $pages := union .RegularPages .Sections }} {{- if .IsHome }} {{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }} -{{- end}} +{{- end }} -{{ $paginator := .Paginate $pages }} +{{- $paginator := .Paginate $pages }} {{- if and .IsHome .Site.Params.homeInfoParams (eq $paginator.PageNumber 1) }} {{- partial "home_info.html" . }} {{- end }} -{{ $term := .Data.Term}} +{{- $term := .Data.Term }} {{- range $index, $page := $paginator.Pages }} {{- $class := "post-entry" }} @@ -41,17 +49,17 @@ {{- end }} <article class="{{ $class }}"> - {{- $isHidden := (.Site.Params.cover.hidden | default .Site.Params.cover.hiddenInList)}} + {{- $isHidden := (.Site.Params.cover.hidden | default .Site.Params.cover.hiddenInList) }} {{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }} <header class="entry-header"> <h2> - {{ .Title }} - {{- if .Draft }}<div class="entry-isdraft"><sup>&nbsp;&nbsp;[draft]</sup></div>{{- end }} + {{- .Title }} + {{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[draft]</span></sup>{{- end }} </h2> </header> - {{- if (ne (.Param "hideSummary") true)}} + {{- if (ne (.Param "hideSummary") true) }} <section class="entry-content"> - <p>{{ .Summary | plainify | htmlUnescape }}{{- if .Truncated }}...{{- end -}}</p> + <p>{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}</p> </section> {{- end }} {{- if not (.Param "hideMeta") }} @@ -75,5 +83,7 @@ </nav> </footer> {{- end }} -{{end}}{{/* end profileMode */}} + +{{- end }}{{/* end profileMode */}} + {{- end }}{{- /* end main */ -}} diff --git a/themes/PaperMod/layouts/_default/rss.xml b/themes/PaperMod/layouts/_default/rss.xml @@ -11,7 +11,7 @@ {{- $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"> +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"> <channel> <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> <link>{{ .Permalink }}</link> @@ -40,6 +40,9 @@ {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} <guid>{{ .Permalink }}</guid> <description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description> + {{- if .Site.Params.ShowFullTextinRSS }} + <content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded> + {{- end }} </item> {{- end }} {{ end }} diff --git a/themes/PaperMod/layouts/_default/search.html b/themes/PaperMod/layouts/_default/search.html @@ -1,7 +1,7 @@ {{- define "main" }} <header class="page-header"> - <h1>{{ .Title }} + <h1>{{- (printf "%s&nbsp;" .Title ) | htmlUnescape -}} <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <circle cx="11" cy="11" r="8"></circle> @@ -17,11 +17,12 @@ <div class="post-meta"> {{- partial "translation_list.html" . -}} </div> - {{- end}} + {{- end }} </header> <div id="searchbox"> - <input id="searchInput" autofocus placeholder="{{.Title}} ↵" aria-label="search" type="search"> + <input id="searchInput" autofocus placeholder="{{ .Params.placeholder | default (printf "%s ↵" .Title) }}" + aria-label="search" type="search" autocomplete="off"> <ul id="searchResults" aria-label="search results"></ul> </div> diff --git a/themes/PaperMod/layouts/_default/single.html b/themes/PaperMod/layouts/_default/single.html @@ -2,10 +2,10 @@ <article class="post-single"> <header class="post-header"> - {{- partial "breadcrumbs.html" . }} + {{ partial "breadcrumbs.html" . }} <h1 class="post-title"> {{ .Title }} - {{- if .Draft }}<div class="entry-isdraft"><sup>&nbsp;&nbsp;[draft]</sup></div>{{- end }} + {{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[draft]</span></sup>{{- end }} </h1> {{- if .Description }} <div class="post-description"> @@ -14,29 +14,27 @@ {{- end }} {{- if not (.Param "hideMeta") }} <div class="post-meta"> - {{- partial "post_meta.html" . -}} + {{- partial "post_meta.html" . -}} {{- partial "translation_list.html" . -}} {{- partial "edit_post.html" . -}} + {{- partial "post_canonical.html" . -}} </div> - {{- end}} + {{- end }} </header> - {{- $isHidden := .Params.cover.hidden | default .Site.Params.cover.hiddenInSingle | default .Site.Params.cover.hidden}} + {{- $isHidden := .Params.cover.hidden | default .Site.Params.cover.hiddenInSingle | default .Site.Params.cover.hidden }} {{- partial "cover.html" (dict "cxt" . "IsHome" false "isHidden" $isHidden) }} {{- if (.Param "ShowToc") }} - <div class="toc"> - <details {{if (.Param "TocOpen") }} open{{ end }}> - <summary accesskey="c" title="(Alt + C)"> - <div class="details">{{- i18n "toc" | default "Table of Contents" }}</div> - </summary> - <div class="inner"> - {{- partial "toc.html" . }} - </div> - </details> - </div> + {{- partial "toc.html" . }} {{- end }} + + {{- if .Content }} <div class="post-content"> + {{- if not (.Param "disableAnchoredHeadings") }} {{- partial "anchored_headings.html" .Content -}} + {{- else }}{{ .Content }}{{ end }} </div> + {{- end }} + <footer class="post-footer"> {{- if .Params.tags }} <ul class="post-tags"> @@ -46,28 +44,10 @@ </ul> {{- end }} {{- if (.Param "ShowPostNavLinks") }} - {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} - {{- if and (gt (len $pages) 1) (in $pages . ) }} - <nav class="paginav"> - {{- with $pages.Next . }} - <a class="prev" href="{{.Permalink}}"> - <span class="title">« {{ i18n "prev_page" }}</span> - <br> - <span>{{- .Name -}}</span> - </a> - {{- end}} - {{- with $pages.Prev . }} - <a class="next" href="{{.Permalink}}"> - <span class="title">{{ i18n "next_page" }} »</span> - <br> - <span>{{- .Name -}}</span> - </a> - {{- end}} - </nav> - {{- end }} + {{- partial "post_nav_links.html" . }} {{- end }} - {{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true) ) }} - {{- partial "share_icons.html" . }} + {{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true)) }} + {{- partial "share_icons.html" . -}} {{- end }} </footer> @@ -76,4 +56,4 @@ {{- end }} </article> -{{- end }}{{/* end main */}} +{{- end }}{{/* end main */}} diff --git a/themes/PaperMod/layouts/_default/terms.html b/themes/PaperMod/layouts/_default/terms.html @@ -1,4 +1,4 @@ -{{ define "main" }} +{{- define "main" }} {{- if .Title }} <header class="page-header"> @@ -24,4 +24,4 @@ {{- end }} </ul> -{{ end }}{{/* end main */}} +{{- end }}{{/* end main */ -}} diff --git a/themes/PaperMod/layouts/partials/anchored_headings.html b/themes/PaperMod/layouts/partials/anchored_headings.html @@ -1,2 +1,2 @@ -<!-- formats .Content headings by adding an anchor --> +{{- /* formats .Content headings by adding an anchor */ -}} {{ . | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" "${1}<a hidden class=\"anchor\" aria-hidden=\"true\" href=\"#${2}\">#</a>${3}" | safeHTML }} diff --git a/themes/PaperMod/layouts/partials/author.html b/themes/PaperMod/layouts/partials/author.html @@ -1,7 +1,7 @@ {{- if or .Params.author .Site.Params.author }} -{{- $author := (.Params.author | default .Site.Params.author)}} +{{- $author := (.Params.author | default .Site.Params.author) }} {{- $author_type := (printf "%T" $author) }} -{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}") ) }} +{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }} {{- (delimit $author ", " ) }} {{- else }} {{- $author }} diff --git a/themes/PaperMod/layouts/partials/breadcrumbs.html b/themes/PaperMod/layouts/partials/breadcrumbs.html @@ -1,9 +1,9 @@ -{{- if (.Param "ShowBreadCrumbs")}} +{{- if (.Param "ShowBreadCrumbs") -}} <div class="breadcrumbs"> - {{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }} - {{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }} + {{- $url := replace .Parent.Permalink (printf "%s" .Site.BaseURL) "" }} + {{- $lang_url := strings.TrimPrefix (printf "%s/" .Lang) $url -}} - <a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a> + <a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home" }}</a> {{- $scratch := newScratch }} {{- range $index, $element := split $lang_url "/" }} @@ -14,6 +14,6 @@ {{- print "&nbsp;»&nbsp;" | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a> {{- end }} - {{- end }} + {{- end -}} </div> -{{- end }} +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/comments.html b/themes/PaperMod/layouts/partials/comments.html @@ -1,5 +1,3 @@ -<!-- Comments area start --> -<!-- -to add comments read => https://gohugo.io/content-management/comments/ ---> -<!-- Comments area end -->- \ No newline at end of file +{{- /* Comments area start */ -}} +{{- /* to add comments read => https://gohugo.io/content-management/comments/ */ -}} +{{- /* Comments area end */ -}} diff --git a/themes/PaperMod/layouts/partials/cover.html b/themes/PaperMod/layouts/partials/cover.html @@ -2,28 +2,33 @@ {{- if (and .Params.cover.image (not $.isHidden)) }} {{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }} <figure class="entry-cover"> + {{- $responsiveImages := (.Params.cover.responsiveImages | default .Site.Params.cover.responsiveImages) | default true }} {{- $addLink := (and .Site.Params.cover.linkFullImages (not $.IsHome)) }} - {{- $cover := (.Page.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} + {{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} {{- if $cover -}}{{/* i.e it is present in page bundle */}} {{- if $addLink }}<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank" rel="noopener noreferrer">{{ end -}} {{- $sizes := (slice "360" "480" "720" "1080" "1500") }} - {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") }} + {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}} + {{- if hugo.IsExtended -}} + {{- $processableFormats = $processableFormats | append "webp" -}} + {{- end -}} {{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }} - {{- if (and (in $processableFormats $cover.MediaType.SubType) (ne .Site.Params.cover.responsiveImages false) (eq $prod true)) }} - <img srcset="{{- range $size := $sizes -}} + {{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }} + <img loading="lazy" srcset="{{- range $size := $sizes -}} {{- if (ge $cover.Width $size) -}} {{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw ," $size) -}} {{ end }} - {{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}" - sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}" alt="{{ $alt }}" /> + {{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}" + sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}" alt="{{ $alt }}" + width="{{ $cover.Width }}" height="{{ $cover.Height }}"> {{- else }}{{/* Unprocessable image or responsive images disabled */}} - <img src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}"> + <img loading="lazy" src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}"> {{- end }} {{- else }}{{/* For absolute urls and external links, no img processing here */}} {{- if $addLink }}<a href="{{ (.Params.cover.image) | absURL }}" target="_blank" rel="noopener noreferrer">{{ end -}} - <img src="{{ (.Params.cover.image) | absURL }}" alt="{{ $alt }}"> + <img loading="lazy" src="{{ (.Params.cover.image) | absURL }}" alt="{{ $alt }}"> {{- end }} {{- if $addLink }}</a>{{ end -}} {{/* Display Caption */}} @@ -32,4 +37,4 @@ {{- end }} </figure> {{- end }}{{/* End image */}} -{{- end -}}{{/* End context */}} +{{- end -}}{{/* End context */ -}} diff --git a/themes/PaperMod/layouts/partials/edit_post.html b/themes/PaperMod/layouts/partials/edit_post.html @@ -1,6 +1,8 @@ {{- if or .Params.editPost.URL .Site.Params.editPost.URL -}} -{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }}|&nbsp;{{- end -}} -<a href="{{ .Params.editPost.URL | default .Site.Params.editPost.URL }}{{ if .Params.editPost.appendFilePath | default ( .Site.Params.editPost.appendFilePath | default false ) }}/{{ .File.Path }}{{ end }}" rel="noopener noreferrer" target="_blank"> - {{- .Params.editPost.Text | default (.Site.Params.editPost.Text | default (i18n "edit_post" | default "Edit") ) -}} +{{- $fileUrlPath := path.Join .File.Path }} + +{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }}&nbsp;|&nbsp;{{- end -}} +<a href="{{ .Params.editPost.URL | default .Site.Params.editPost.URL }}{{ if .Params.editPost.appendFilePath | default ( .Site.Params.editPost.appendFilePath | default false ) }}/{{ $fileUrlPath }}{{ end }}" rel="noopener noreferrer" target="_blank"> + {{- .Params.editPost.Text | default (.Site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}} </a> {{- end }} diff --git a/themes/PaperMod/layouts/partials/extend_footer.html b/themes/PaperMod/layouts/partials/extend_footer.html @@ -1,5 +1,3 @@ -<!-- Footer custom content area start --> -<!-- -Insert any custom code web-analytics, resources, etc. here ---> -<!-- Footer custom content area end --> +{{- /* Footer custom content area start */ -}} +{{- /* Insert any custom code web-analytics, resources, etc. here */ -}} +{{- /* Footer custom content area end */ -}} diff --git a/themes/PaperMod/layouts/partials/extend_head.html b/themes/PaperMod/layouts/partials/extend_head.html @@ -1,5 +1,4 @@ -<!-- Head custom content area start --> -<!-- -Insert any custom code (web-analytics, resources, etc.) - it will appear in the <head></head> section of every page. Can be overwritten by partial with the same name in the global layouts. ---> -<!-- Head custom content area end -->- \ No newline at end of file +{{- /* Head custom content area start */ -}} +{{- /* Insert any custom code (web-analytics, resources, etc.) - it will appear in the <head></head> section of every page. */ -}} +{{- /* Can be overwritten by partial with the same name in the global layouts. */ -}} +{{- /* Head custom content area end */ -}} diff --git a/themes/PaperMod/layouts/partials/footer.html b/themes/PaperMod/layouts/partials/footer.html @@ -1,46 +1,37 @@ +{{- if not (.Param "hideFooter") }} <footer class="footer"> {{- if .Site.Copyright }} <span>{{ .Site.Copyright | markdownify }}</span> {{- else }} <span>&copy; {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></span> {{- end }} - <span>&middot;</span> - <span>Powered by <a href="https://gohugo.io/" rel="noopener noreferrer" target="_blank">Hugo</a></span> - <span>&middot;</span> - <span>Theme <a href="https://git.io/hugopapermod" rel="noopener" target="_blank">PaperMod</a></span> + <span> + Powered by + <a href="https://gohugo.io/" rel="noopener noreferrer" target="_blank">Hugo</a> & + <a href="https://git.io/hugopapermod" rel="noopener" target="_blank">PaperMod</a> + </span> </footer> +{{- end }} + {{- if (not .Site.Params.disableScrollToTop) }} -<a href="#top" aria-label="go to top" title="Go to Top (Alt + G)"> - <button class="top-link" id="top-link" type="button" accesskey="g"> - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor"> - <path d="M12 6H0l6-6z" /> - </svg> - </button> +<a href="#top" aria-label="go to top" title="Go to Top (Alt + G)" class="top-link" id="top-link" accesskey="g"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor"> + <path d="M12 6H0l6-6z" /> + </svg> </a> {{- end }} -{{- partial "extend_footer.html" . -}} -{{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default .Params.disableHLJS ) }} -{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }} -{{- if not .Site.Params.assets.disableFingerprinting }} -{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }} -<script defer src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}" - onload="hljs.initHighlightingOnLoad();"></script> -{{- else}} -{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify }} -<script defer src="{{ $highlight.RelPermalink }}" onload="hljs.initHighlightingOnLoad();"></script> -{{- end}} -{{- end }} + +{{- partial "extend_footer.html" . }} + <script> - window.onload = function () { - if (localStorage.getItem("menu-scroll-position")) { - document.getElementById('menu').scrollLeft = localStorage.getItem("menu-scroll-position"); + let menu = document.getElementById('menu') + if (menu) { + menu.scrollLeft = localStorage.getItem("menu-scroll-position"); + menu.onscroll = function () { + localStorage.setItem("menu-scroll-position", menu.scrollLeft); } } - function menu_on_scroll() { - localStorage.setItem("menu-scroll-position", document.getElementById('menu').scrollLeft); - } - document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener("click", function (e) { e.preventDefault(); @@ -92,3 +83,53 @@ </script> {{- end }} + +{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (.Param "ShowCodeCopyButtons")) }} +<script> + document.querySelectorAll('pre > code').forEach((codeblock) => { + const container = codeblock.parentNode.parentNode; + + const copybutton = document.createElement('button'); + copybutton.classList.add('copy-code'); + copybutton.innerText = '{{- i18n "code_copy" | default "copy" }}'; + + function copyingDone() { + copybutton.innerText = '{{- i18n "code_copied" | default "copied!" }}'; + setTimeout(() => { + copybutton.innerText = '{{- i18n "code_copy" | default "copy" }}'; + }, 2000); + } + + copybutton.addEventListener('click', (cb) => { + if ('clipboard' in navigator) { + navigator.clipboard.writeText(codeblock.textContent); + copyingDone(); + return; + } + + const range = document.createRange(); + range.selectNodeContents(codeblock); + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + try { + document.execCommand('copy'); + copyingDone(); + } catch (e) { }; + selection.removeRange(range); + }); + + if (container.classList.contains("highlight")) { + container.appendChild(copybutton); + } else if (container.parentNode.firstChild == container) { + // td containing LineNos + } else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") { + // table containing LineNos and code + codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton); + } else { + // code blocks not having highlight as parent class + codeblock.parentNode.appendChild(copybutton); + } + }); +</script> +{{- end }} diff --git a/themes/PaperMod/layouts/partials/head.html b/themes/PaperMod/layouts/partials/head.html @@ -4,82 +4,163 @@ {{- if hugo.IsProduction | or (eq .Site.Params.env "production") }} <meta name="robots" content="index, follow"> {{- else }} -<meta name=" robots" content="noindex, nofollow"> -{{- end -}} -<!-- Title --> -<title>{{ if .IsHome }}{{else}}{{ if .Title }}{{ .Title }} | {{ end }}{{end}}{{ .Site.Title }}</title> -<!-- Meta --> +<meta name="robots" content="noindex, nofollow"> +{{- end }} + +{{- /* Title */}} +<title>{{ if .IsHome }}{{ else }}{{ if .Title }}{{ .Title }} | {{ end }}{{ end }}{{ .Site.Title }}</title> + +{{- /* Meta */}} +{{- if .IsHome }} +{{ with .Site.Params.keywords -}}<meta name="keywords" content="{{- range $i, $e := . }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" />{{ end }} +{{- else }} <meta name="keywords" content="{{ if .Params.keywords -}} {{- range $i, $e := .Params.keywords }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- else }} {{- range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- end -}}" /> -<meta name="description" content="{{- with .Description }}{{ . }}{{- else }}{{- if .IsPage}} +{{- end }} +<meta name="description" content="{{- with .Description }}{{ . }}{{- else }}{{- if or .IsPage .IsSection}} {{- .Summary | default (printf "%s - %s" .Title .Site.Title) }}{{- else }} {{- with .Site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}"> <meta name="author" content="{{ (partial "author.html" . ) }}"> <link rel="canonical" href="{{ if .Params.canonicalURL -}} {{ trim .Params.canonicalURL " " }} {{- else -}} {{ .Permalink }} {{- end }}" /> {{- if .Site.Params.analytics.google.SiteVerificationTag }} <meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" /> -{{- end}} +{{- end }} {{- if .Site.Params.analytics.yandex.SiteVerificationTag }} <meta name="yandex-verification" content="{{ .Site.Params.analytics.yandex.SiteVerificationTag }}" /> -{{- end}} +{{- end }} {{- if .Site.Params.analytics.bing.SiteVerificationTag }} <meta name="msvalidate.01" content="{{ .Site.Params.analytics.bing.SiteVerificationTag }}" /> -{{- end}} -<!-- Styles --> -{{- $common := (resources.Match "css/*.css") | resources.Concat "assets/css/common.css" }} +{{- end }} + +{{- /* Styles */}} +{{- $theme_vars := (resources.Get "css/core/theme-vars.css") }} +{{- $reset := (resources.Get "css/core/reset.css") }} +{{- $media := (resources.Get "css/core/zmedia.css") }} +{{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }} + +{{- /* include `an-old-hope` if hljs is on */}} +{{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default false) }} +{{- $hljs := (cond ($isHLJSdisabled) (" " | resources.FromString "assets/css/hljs-blank.css") (resources.Get "css/hljs/an-old-hope.min.css")) }} + +{{- /* order is important */}} +{{- $core := (slice $theme_vars $reset $common $hljs $media) | resources.Concat "assets/css/core.css" }} {{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" }} -{{- /* bundle all required css */}} -{{- /* Add extended css after theme style */ -}} -{{- $stylesheet := (slice $common $extended) | resources.Concat "assets/css/stylesheet.css" | minify }} + +{{- /* bundle all required css */}} +{{- /* Add extended css after theme style */ -}} +{{- $stylesheet := (slice $core $extended) | resources.Concat "assets/css/stylesheet.css" | minify }} {{- if not .Site.Params.assets.disableFingerprinting }} -{{- $stylesheet := $stylesheet | fingerprint -}} -<link href="{{ $stylesheet.RelPermalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" - as="style"> -{{- else}} -<link href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style"> -{{- end}} -<!-- Search --> +{{- $stylesheet := $stylesheet | fingerprint }} +<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" as="style"> +{{- else }} +<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style"> +{{- end }} + +{{- with .Site.Params.profileMode }} +{{- if and .enabled .imageUrl $.IsHome }} +<link rel="preload" href="{{ .imageUrl }}" as="image"> +{{- end }} +{{- end }} + +{{- with .Site.Params.label.icon }} +<link rel="preload" href="{{ . }}" as="image"> +{{- end }} + +{{- /* Search */}} {{- if (eq .Layout `search`) -}} -<link rel="preload" as="fetch" href="../index.json" crossOrigin="anonymous"> -{{- $fastsearch := resources.Get "js/fastsearch.js" | resources.ExecuteAsTemplate "js/fastsearch.js" .Site.Params.fuseOpts }} +<link crossorigin="anonymous" rel="preload" as="fetch" href="../index.json"> +{{- $fastsearch := resources.Get "js/fastsearch.js" | js.Build (dict "params" (dict "fuseOpts" .Site.Params.fuseOpts)) }} {{- $fusejs := resources.Get "js/fuse.js" }} {{- if not .Site.Params.assets.disableFingerprinting }} {{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify | fingerprint }} -<script defer src="{{ $search.RelPermalink }}" onload="loadSearch();" integrity="{{ $search.Data.Integrity }}"></script> -{{- else}} -{{ $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify }} -<script defer src="{{ $search.RelPermalink }}" onload="loadSearch();"></script> -{{- end}} +<script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script> +{{- else }} +{{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify }} +<script defer crossorigin="anonymous" src="{{ $search.RelPermalink }}"></script> +{{- end }} {{- end -}} -<!-- Favicons --> -<link rel="icon" href="{{- .Site.Params.assets.favicon | default "favicon.ico" | absURL -}}"> -<link rel="icon" type="image/png" sizes="16x16" href=" - {{- .Site.Params.assets.favicon16x16 | default "favicon-16x16.png" | absURL -}}"> -<link rel="icon" type="image/png" sizes="32x32" href=" - {{- .Site.Params.assets.favicon32x32 | default "favicon-32x32.png" | absURL -}}"> -<link rel="apple-touch-icon" href=" - {{- .Site.Params.assets.apple_touch_icon | default "apple-touch-icon.png" | absURL -}}"> -<link rel="mask-icon" href="{{- .Site.Params.assets.safari_pinned_tab | default "safari-pinned-tab.svg" | absURL -}}"> -<meta name="theme-color" content="#2e2e33"> -<meta name="msapplication-TileColor" content="#2e2e33"> -<!-- Generator --> -{{- hugo.Generator }} -<!-- RSS --> -{{- range .AlternativeOutputFormats -}} -<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}"> +{{- /* Highlight.js */}} +{{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default .Params.disableHLJS ) }} +{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }} +{{- if not .Site.Params.assets.disableFingerprinting }} +{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }} +<script defer crossorigin="anonymous" src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}" + onload="hljs.initHighlightingOnLoad();"></script> +{{- else }} +{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify }} +<script defer crossorigin="anonymous" src="{{ $highlight.RelPermalink }}" onload="hljs.initHighlightingOnLoad();"></script> +{{- end }} +{{- end }} + +{{- /* Favicons */}} +<link rel="icon" href="{{ .Site.Params.assets.favicon | default "favicon.ico" | absURL }}"> +<link rel="icon" type="image/png" sizes="16x16" href="{{ .Site.Params.assets.favicon16x16 | default "favicon-16x16.png" | absURL }}"> +<link rel="icon" type="image/png" sizes="32x32" href="{{ .Site.Params.assets.favicon32x32 | default "favicon-32x32.png" | absURL }}"> +<link rel="apple-touch-icon" href="{{ .Site.Params.assets.apple_touch_icon | default "apple-touch-icon.png" | absURL }}"> +<link rel="mask-icon" href="{{ .Site.Params.assets.safari_pinned_tab | default "safari-pinned-tab.svg" | absURL }}"> +<meta name="theme-color" content="{{ .Site.Params.assets.theme_color | default "#2e2e33" }}"> +<meta name="msapplication-TileColor" content="{{ .Site.Params.assets.msapplication_TileColor | default "#2e2e33" }}"> + +{{- /* Generator */}} +{{ hugo.Generator }} + +{{- /* RSS */}} +{{ range .AlternativeOutputFormats -}} +<link rel="{{ .Rel }}" type="{{ .MediaType.Type | html }}" href="{{ .Permalink | safeURL }}"> {{ end -}} {{- range .AllTranslations -}} -<link rel="alternate" hreflang="{{- .Lang -}}" href="{{- .Permalink -}}" /> -{{ end }} +<link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}" /> +{{ end -}} + +<noscript> + <style> + #theme-toggle, + .top-link { + display: none; + } + + </style> + {{- if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark")) }} + <style> + @media (prefers-color-scheme: dark) { + :root { + --theme: rgb(29, 30, 32); + --entry: rgb(46, 46, 51); + --primary: rgb(218, 218, 219); + --secondary: rgb(155, 156, 157); + --tertiary: rgb(65, 66, 68); + --content: rgb(196, 196, 197); + --hljs-bg: rgb(46, 46, 51); + --code-bg: rgb(55, 56, 62); + --border: rgb(51, 51, 51); + } + + .list { + background: var(--theme); + } + + .list:not(.dark)::-webkit-scrollbar-track { + background: 0 0; + } + + .list:not(.dark)::-webkit-scrollbar-thumb { + border-color: var(--theme); + } + } + + </style> + {{- end }} +</noscript> + {{- partial "extend_head.html" . -}} -<!-- Misc --> + +{{- /* Misc */}} {{- if hugo.IsProduction | or (eq .Site.Params.env "production") }} -{{- template "_internal/google_analytics_async.html" . }} -{{- template "_internal/google_news.html" . }} +{{- template "_internal/google_analytics.html" . }} {{- template "partials/templates/opengraph.html" . }} {{- template "partials/templates/twitter_cards.html" . }} {{- template "partials/templates/schema_json.html" . }} -{{- end }} +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/header.html b/themes/PaperMod/layouts/partials/header.html @@ -1,6 +1,6 @@ -{{- /* theme-toggle is enabled */}} +{{- /* theme-toggle is enabled */}} {{- if (not .Site.Params.disableThemeToggle) }} -{{- /* theme is light */}} +{{- /* theme is light */}} {{- if (eq .Site.Params.defaultTheme "light") }} <script> if (localStorage.getItem("pref-theme") === "dark") { @@ -8,7 +8,7 @@ } </script> -{{- /* theme is dark */}} +{{- /* theme is dark */}} {{- else if (eq .Site.Params.defaultTheme "dark") }} <script> if (localStorage.getItem("pref-theme") === "light") { @@ -17,7 +17,7 @@ </script> {{- else }} -{{- /* theme is auto */}} +{{- /* theme is auto */}} <script> if (localStorage.getItem("pref-theme") === "dark") { document.body.classList.add('dark'); @@ -29,7 +29,7 @@ </script> {{- end }} -{{- /* theme-toggle is disabled and theme is auto */}} +{{- /* theme-toggle is disabled and theme is auto */}} {{- else if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark"))}} <script> if (window.matchMedia('(prefers-color-scheme: dark)').matches) { @@ -38,55 +38,18 @@ </script> {{- end }} -<noscript> - <style type="text/css"> - #theme-toggle, - .top-link { - display: none; - } - </style> - {{- if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark")) }} - <style> - @media (prefers-color-scheme: dark) { - :root { - --theme: #1d1e20; - --entry: #2e2e33; - --primary: rgba(255, 255, 255, 0.84); - --secondary: rgba(255, 255, 255, 0.56); - --tertiary: rgba(255, 255, 255, 0.16); - --content: rgba(255, 255, 255, 0.74); - --hljs-bg: #2e2e33; - --code-bg: #37383e; - --border: #333; - } - - .list { - background: var(--theme); - } - - .list:not(.dark)::-webkit-scrollbar-track { - background: 0 0; - } - - .list:not(.dark)::-webkit-scrollbar-thumb { - border-color: var(--theme); - } - } - </style> - {{- end }} - -</noscript> <header class="header"> <nav class="nav"> <div class="logo"> - {{- if .Title }} - <a href="{{ "" | absLangURL }}" accesskey="h" title="{{ .Site.Params.label.text | default .Site.Title }} (Alt + H)"> + {{- $label_text := (.Site.Params.label.text | default .Site.Title) }} + {{- if .Site.Title }} + <a href="{{ "" | absLangURL }}" accesskey="h" title="{{ $label_text }} (Alt + H)"> {{- if .Site.Params.label.icon }} - <img src="{{- .Site.Params.label.icon -}}" alt="logo" aria-label="logo" - height="{{- .Site.Params.label.iconHeight | default "30px" -}}"> + <img src="{{- .Site.Params.label.icon | absURL -}}" alt="logo" aria-label="logo" + height="{{- .Site.Params.label.iconHeight | default " 30px" -}}"> {{- end -}} - {{- .Site.Params.label.text | default .Site.Title -}} + {{- $label_text -}} </a> {{- end }} <span class="logo-switches"> @@ -111,22 +74,22 @@ <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> </svg> </button> - {{- end}} - {{ $lang := .Lang}} - {{ $separator := or .Title (not .Site.Params.disableThemeToggle)}} - {{- with $.Site.Home.AllTranslations }} + {{- end }} + {{- $lang := .Lang}} + {{- $separator := or $label_text (not .Site.Params.disableThemeToggle)}} + {{- with $.Site.Home.AllTranslations }} <ul class="lang-switch"> {{- if $separator }}<li>|</li>{{ end }} {{- range . -}} {{- if ne $lang .Lang }} <li> - <a href="{{- .Permalink -}}" title="{{ .Language.LanguageName | default (.Lang | humanize) }}" - aria-label="{{ .Language.LanguageName | default (.Lang | humanize) }}"> + <a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}" + aria-label="{{ .Language.LanguageName | default (.Lang | title) }}"> {{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }} {{- .Language.LanguageName | emojify -}} {{- else }} - {{- .Lang | humanize -}} + {{- .Lang | title -}} {{- end -}} </a> </li> @@ -137,20 +100,22 @@ </span> </div> {{- $currentPage := . }} - <ul id="menu" onscroll="menu_on_scroll()"> + <ul id="menu"> {{- range .Site.Menus.main }} {{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }} - {{- $page_url:= $currentPage.Permalink | absLangURL }} + {{- $page_url:= $currentPage.Permalink | absLangURL }} {{- $is_search := eq ($.Site.GetPage .KeyName).Layout `search` }} <li> <a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}" {{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}> <span {{- if eq $menu_item_url $page_url }} class="active" {{- end }}> + {{- .Pre }} {{- .Name -}} + {{ .Post -}} </span> </a> </li> - {{- end -}} + {{- end }} </ul> </nav> </header> diff --git a/themes/PaperMod/layouts/partials/home_info.html b/themes/PaperMod/layouts/partials/home_info.html @@ -1,13 +1,13 @@ {{- with $.Site.Params.homeInfoParams }} <article class="first-entry home-info"> <header class="entry-header"> - <h1>{{- .Title | markdownify }}</h1> + <h1>{{ .Title | markdownify }}</h1> </header> <section class="entry-content"> - <p>{{- .Content | markdownify }}</p> + <p>{{ .Content | markdownify }}</p> </section> <footer class="entry-footer"> - {{- partial "social_icons.html" $.Site.Params.socialIcons -}} + {{ partial "social_icons.html" $.Site.Params.socialIcons }} </footer> </article> -{{- end}} +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/index_profile.html b/themes/PaperMod/layouts/partials/index_profile.html @@ -1,19 +1,21 @@ <div class="profile"> {{- with .Site.Params.profileMode }} <div class="profile_inner"> - {{- if .imageUrl}}<img src="{{ .imageUrl}}" alt="{{ .imageTitle | default "profile image" }}" - height="{{- .imageHeight | default 150 -}}" width="{{- .imageWidth | default 150 -}}" />{{- end}} - <h1>{{- .title | default $.Site.Title | markdownify -}}</h1> - <span>{{- .subtitle | markdownify -}}</span> + {{- if .imageUrl -}} + <img src="{{ .imageUrl | absURL }}" alt="{{ .imageTitle | default "profile image" }}" + height="{{ .imageHeight | default 150 }}" width="{{ .imageWidth | default 150 }}" /> + {{- end }} + <h1>{{ .title | default $.Site.Title | markdownify }}</h1> + <span>{{ .subtitle | markdownify }}</span> {{- partial "social_icons.html" $.Site.Params.socialIcons -}} {{- with .buttons }} <div class="buttons"> - {{- range . -}} - <a class="button" href="{{ trim .url " " }}" rel="noopener" title="{{ .name | humanize }}"> - <span class="button-inner">{{ .name }}</span> + {{- range . }} + <a class="button" href="{{ trim .url " " }}" rel="noopener" title="{{ .name | title }}"> + <span class="button-inner">{{ .name | title }}</span> </a> - {{- end -}} + {{- end }} </div> {{- end }} </div> diff --git a/themes/PaperMod/layouts/partials/post_canonical.html b/themes/PaperMod/layouts/partials/post_canonical.html @@ -0,0 +1,9 @@ +{{ if and (.Params.canonicalURL) (.Params.ShowCanonicalLink ) -}} +{{ $url := urls.Parse .Params.canonicalURL }} + +{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated (or .Params.editPost.URL .Site.Params.editPost.URL) }}&nbsp;|&nbsp;{{- end -}} +<span> + {{- (.Site.Params.CanonicalLinkText | default .Params.CanonicalLinkText) | default "Originally published at" -}} + &nbsp;<a href="{{ trim .Params.canonicalURL " " }}" title="{{ trim .Params.canonicalURL " " }}" target="_blank" rel="noopener noreferrer">{{ $url.Host }}</a> +</span> +{{- end }} diff --git a/themes/PaperMod/layouts/partials/post_meta.html b/themes/PaperMod/layouts/partials/post_meta.html @@ -1,17 +1,17 @@ -{{- $scratch := newScratch}} +{{- $scratch := newScratch }} {{- if not .Date.IsZero -}} -{{- $scratch.Add "meta" (slice (.Date.Format (default "January 2, 2006" .Site.Params.DateFormat))) }} -{{- end -}} +{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default "January 2, 2006" .Site.Params.DateFormat)))) }} +{{- end }} {{- if (.Param "ShowReadingTime") -}} -{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%s min" .ReadingTime))) }} -{{- end -}} - -{{ with (partial "author.html" . ) }} -{{ $scratch.Add "meta" (slice .)}} -{{end}} +{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime))) }} +{{- end }} -{{- with ($scratch.Get "meta")}} -{{- delimit . "&nbsp;·&nbsp;"}} +{{- with (partial "author.html" .) }} +{{- $scratch.Add "meta" (slice .) }} {{- end }} + +{{- with ($scratch.Get "meta") }} +{{- delimit . "&nbsp;·&nbsp;" -}} +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/post_nav_links.html b/themes/PaperMod/layouts/partials/post_nav_links.html @@ -0,0 +1,19 @@ +{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} +{{- if and (gt (len $pages) 1) (in $pages . ) }} +<nav class="paginav"> + {{- with $pages.Next . }} + <a class="prev" href="{{ .Permalink }}"> + <span class="title">« {{ i18n "prev_page" }}</span> + <br> + <span>{{- .Name -}}</span> + </a> + {{- end }} + {{- with $pages.Prev . }} + <a class="next" href="{{ .Permalink }}"> + <span class="title">{{ i18n "next_page" }} »</span> + <br> + <span>{{- .Name -}}</span> + </a> + {{- end }} +</nav> +{{- end }} diff --git a/themes/PaperMod/layouts/partials/share_icons.html b/themes/PaperMod/layouts/partials/share_icons.html @@ -1,15 +1,20 @@ {{- $pageurl := .Permalink }} {{- $title := .Title }} -{{ $.Scratch.Set "tags" ""}} +{{- $.Scratch.Set "tags" ""}} {{- with .Params.Tags }} -{{ $hashtags := newScratch}} -{{ range . }}{{ $hashtags.Add "tags" (slice (replaceRE "(\\s)" "" . ))}}{{end}} -{{ $.Scratch.Set "tags" (delimit ($hashtags.Get "tags") ",") }} -{{- end }} +{{- $hashtags := newScratch}} +{{- range . }}{{ $hashtags.Add "tags" (slice (replaceRE "(\\s)" "" . ))}}{{end}} +{{- $.Scratch.Set "tags" (delimit ($hashtags.Get "tags") ",") }} +{{- end -}} + +{{- $custom := false }} +{{- $ShareButtons := (.Param "ShareButtons")}} +{{- with $ShareButtons }}{{ $custom = true }}{{ end }} <div class="share-buttons"> + {{- if (cond ($custom) (in $ShareButtons "twitter") (true)) }} <a target="_blank" rel="noopener noreferrer" aria-label="share {{ $title | plainify }} on twitter" href="https://twitter.com/intent/tweet/?text={{ $title }}&amp;url={{ $pageurl }}&amp;hashtags={{- $.Scratch.Get "tags" -}}"> <svg version="1.1" viewBox="0 0 512 512" xml:space="preserve"> @@ -17,6 +22,8 @@ d="M449.446,0c34.525,0 62.554,28.03 62.554,62.554l0,386.892c0,34.524 -28.03,62.554 -62.554,62.554l-386.892,0c-34.524,0 -62.554,-28.03 -62.554,-62.554l0,-386.892c0,-34.524 28.029,-62.554 62.554,-62.554l386.892,0Zm-253.927,424.544c135.939,0 210.268,-112.643 210.268,-210.268c0,-3.218 0,-6.437 -0.153,-9.502c14.406,-10.421 26.973,-23.448 36.935,-38.314c-13.18,5.824 -27.433,9.809 -42.452,11.648c15.326,-9.196 26.973,-23.602 32.49,-40.92c-14.252,8.429 -30.038,14.56 -46.896,17.931c-13.487,-14.406 -32.644,-23.295 -53.946,-23.295c-40.767,0 -73.87,33.104 -73.87,73.87c0,5.824 0.613,11.494 1.992,16.858c-61.456,-3.065 -115.862,-32.49 -152.337,-77.241c-6.284,10.881 -9.962,23.601 -9.962,37.088c0,25.594 13.027,48.276 32.95,61.456c-12.107,-0.307 -23.448,-3.678 -33.41,-9.196l0,0.92c0,35.862 25.441,65.594 59.311,72.49c-6.13,1.686 -12.72,2.606 -19.464,2.606c-4.751,0 -9.348,-0.46 -13.946,-1.38c9.349,29.426 36.628,50.728 68.965,51.341c-25.287,19.771 -57.164,31.571 -91.8,31.571c-5.977,0 -11.801,-0.306 -17.625,-1.073c32.337,21.15 71.264,33.41 112.95,33.41Z" /> </svg> </a> + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "linkedin") (true)) }} <a target="_blank" rel="noopener noreferrer" aria-label="share {{ $title | plainify }} on linkedin" href="https://www.linkedin.com/shareArticle?mini=true&amp;url={{ $pageurl }}&amp;title={{ $title }}&amp;summary={{ $title }}&amp;source={{ $pageurl }}"> <svg version="1.1" viewBox="0 0 512 512" xml:space="preserve"> @@ -24,6 +31,8 @@ d="M449.446,0c34.525,0 62.554,28.03 62.554,62.554l0,386.892c0,34.524 -28.03,62.554 -62.554,62.554l-386.892,0c-34.524,0 -62.554,-28.03 -62.554,-62.554l0,-386.892c0,-34.524 28.029,-62.554 62.554,-62.554l386.892,0Zm-288.985,423.278l0,-225.717l-75.04,0l0,225.717l75.04,0Zm270.539,0l0,-129.439c0,-69.333 -37.018,-101.586 -86.381,-101.586c-39.804,0 -57.634,21.891 -67.617,37.266l0,-31.958l-75.021,0c0.995,21.181 0,225.717 0,225.717l75.02,0l0,-126.056c0,-6.748 0.486,-13.492 2.474,-18.315c5.414,-13.475 17.767,-27.434 38.494,-27.434c27.135,0 38.007,20.707 38.007,51.037l0,120.768l75.024,0Zm-307.552,-334.556c-25.674,0 -42.448,16.879 -42.448,39.002c0,21.658 16.264,39.002 41.455,39.002l0.484,0c26.165,0 42.452,-17.344 42.452,-39.002c-0.485,-22.092 -16.241,-38.954 -41.943,-39.002Z" /> </svg> </a> + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "reddit") (true)) }} <a target="_blank" rel="noopener noreferrer" aria-label="share {{ $title | plainify }} on reddit" href="https://reddit.com/submit?url={{ $pageurl }}&title={{ $title }}"> <svg version="1.1" viewBox="0 0 512 512" xml:space="preserve"> @@ -31,6 +40,8 @@ d="M449.446,0c34.525,0 62.554,28.03 62.554,62.554l0,386.892c0,34.524 -28.03,62.554 -62.554,62.554l-386.892,0c-34.524,0 -62.554,-28.03 -62.554,-62.554l0,-386.892c0,-34.524 28.029,-62.554 62.554,-62.554l386.892,0Zm-3.446,265.638c0,-22.964 -18.616,-41.58 -41.58,-41.58c-11.211,0 -21.361,4.457 -28.841,11.666c-28.424,-20.508 -67.586,-33.757 -111.204,-35.278l18.941,-89.121l61.884,13.157c0.756,15.734 13.642,28.29 29.56,28.29c16.407,0 29.706,-13.299 29.706,-29.701c0,-16.403 -13.299,-29.702 -29.706,-29.702c-11.666,0 -21.657,6.792 -26.515,16.578l-69.105,-14.69c-1.922,-0.418 -3.939,-0.042 -5.585,1.036c-1.658,1.073 -2.811,2.761 -3.224,4.686l-21.152,99.438c-44.258,1.228 -84.046,14.494 -112.837,35.232c-7.468,-7.164 -17.589,-11.591 -28.757,-11.591c-22.965,0 -41.585,18.616 -41.585,41.58c0,16.896 10.095,31.41 24.568,37.918c-0.639,4.135 -0.99,8.328 -0.99,12.576c0,63.977 74.469,115.836 166.33,115.836c91.861,0 166.334,-51.859 166.334,-115.836c0,-4.218 -0.347,-8.387 -0.977,-12.493c14.564,-6.47 24.735,-21.034 24.735,-38.001Zm-119.474,108.193c-20.27,20.241 -59.115,21.816 -70.534,21.816c-11.428,0 -50.277,-1.575 -70.522,-21.82c-3.007,-3.008 -3.007,-7.882 0,-10.889c3.003,-2.999 7.882,-3.003 10.885,0c12.777,12.781 40.11,17.317 59.637,17.317c19.522,0 46.86,-4.536 59.657,-17.321c3.016,-2.999 7.886,-2.995 10.885,0.008c3.008,3.011 3.003,7.882 -0.008,10.889Zm-5.23,-48.781c-16.373,0 -29.701,-13.324 -29.701,-29.698c0,-16.381 13.328,-29.714 29.701,-29.714c16.378,0 29.706,13.333 29.706,29.714c0,16.374 -13.328,29.698 -29.706,29.698Zm-160.386,-29.702c0,-16.381 13.328,-29.71 29.714,-29.71c16.369,0 29.689,13.329 29.689,29.71c0,16.373 -13.32,29.693 -29.689,29.693c-16.386,0 -29.714,-13.32 -29.714,-29.693Z" /> </svg> </a> + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "facebook") (true)) }} <a target="_blank" rel="noopener noreferrer" aria-label="share {{ $title | plainify }} on facebook" href="https://facebook.com/sharer/sharer.php?u={{ $pageurl }}"> <svg version="1.1" viewBox="0 0 512 512" xml:space="preserve"> @@ -38,6 +49,8 @@ d="M449.446,0c34.525,0 62.554,28.03 62.554,62.554l0,386.892c0,34.524 -28.03,62.554 -62.554,62.554l-106.468,0l0,-192.915l66.6,0l12.672,-82.621l-79.272,0l0,-53.617c0,-22.603 11.073,-44.636 46.58,-44.636l36.042,0l0,-70.34c0,0 -32.71,-5.582 -63.982,-5.582c-65.288,0 -107.96,39.569 -107.96,111.204l0,62.971l-72.573,0l0,82.621l72.573,0l0,192.915l-191.104,0c-34.524,0 -62.554,-28.03 -62.554,-62.554l0,-386.892c0,-34.524 28.029,-62.554 62.554,-62.554l386.892,0Z" /> </svg> </a> + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "whatsapp") (true)) }} <a target="_blank" rel="noopener noreferrer" aria-label="share {{ $title | plainify }} on whatsapp" href="https://api.whatsapp.com/send?text={{ $title }}%20-%20{{ $pageurl }}"> <svg version="1.1" viewBox="0 0 512 512" xml:space="preserve"> @@ -45,6 +58,8 @@ d="M449.446,0c34.525,0 62.554,28.03 62.554,62.554l0,386.892c0,34.524 -28.03,62.554 -62.554,62.554l-386.892,0c-34.524,0 -62.554,-28.03 -62.554,-62.554l0,-386.892c0,-34.524 28.029,-62.554 62.554,-62.554l386.892,0Zm-58.673,127.703c-33.842,-33.881 -78.847,-52.548 -126.798,-52.568c-98.799,0 -179.21,80.405 -179.249,179.234c-0.013,31.593 8.241,62.428 23.927,89.612l-25.429,92.884l95.021,-24.925c26.181,14.28 55.659,21.807 85.658,21.816l0.074,0c98.789,0 179.206,-80.413 179.247,-179.243c0.018,-47.895 -18.61,-92.93 -52.451,-126.81Zm-126.797,275.782l-0.06,0c-26.734,-0.01 -52.954,-7.193 -75.828,-20.767l-5.441,-3.229l-56.386,14.792l15.05,-54.977l-3.542,-5.637c-14.913,-23.72 -22.791,-51.136 -22.779,-79.287c0.033,-82.142 66.867,-148.971 149.046,-148.971c39.793,0.014 77.199,15.531 105.329,43.692c28.128,28.16 43.609,65.592 43.594,105.4c-0.034,82.149 -66.866,148.983 -148.983,148.984Zm81.721,-111.581c-4.479,-2.242 -26.499,-13.075 -30.604,-14.571c-4.105,-1.495 -7.091,-2.241 -10.077,2.241c-2.986,4.483 -11.569,14.572 -14.182,17.562c-2.612,2.988 -5.225,3.364 -9.703,1.12c-4.479,-2.241 -18.91,-6.97 -36.017,-22.23c-13.314,-11.876 -22.304,-26.542 -24.916,-31.026c-2.612,-4.484 -0.279,-6.908 1.963,-9.14c2.016,-2.007 4.48,-5.232 6.719,-7.847c2.24,-2.615 2.986,-4.484 4.479,-7.472c1.493,-2.99 0.747,-5.604 -0.374,-7.846c-1.119,-2.241 -10.077,-24.288 -13.809,-33.256c-3.635,-8.733 -7.327,-7.55 -10.077,-7.688c-2.609,-0.13 -5.598,-0.158 -8.583,-0.158c-2.986,0 -7.839,1.121 -11.944,5.604c-4.105,4.484 -15.675,15.32 -15.675,37.364c0,22.046 16.048,43.342 18.287,46.332c2.24,2.99 31.582,48.227 76.511,67.627c10.685,4.615 19.028,7.371 25.533,9.434c10.728,3.41 20.492,2.929 28.209,1.775c8.605,-1.285 26.499,-10.833 30.231,-21.295c3.732,-10.464 3.732,-19.431 2.612,-21.298c-1.119,-1.869 -4.105,-2.99 -8.583,-5.232Z" /> </svg> </a> + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "telegram") (true)) }} <a target="_blank" rel="noopener noreferrer" aria-label="share {{ $title | plainify }} on telegram" href="https://telegram.me/share/url?text={{ $title }}&amp;url={{ $pageurl }}"> <svg version="1.1" xml:space="preserve" viewBox="2 2 28 28"> @@ -52,4 +67,5 @@ d="M26.49,29.86H5.5a3.37,3.37,0,0,1-2.47-1,3.35,3.35,0,0,1-1-2.47V5.48A3.36,3.36,0,0,1,3,3,3.37,3.37,0,0,1,5.5,2h21A3.38,3.38,0,0,1,29,3a3.36,3.36,0,0,1,1,2.46V26.37a3.35,3.35,0,0,1-1,2.47A3.38,3.38,0,0,1,26.49,29.86Zm-5.38-6.71a.79.79,0,0,0,.85-.66L24.73,9.24a.55.55,0,0,0-.18-.46.62.62,0,0,0-.41-.17q-.08,0-16.53,6.11a.59.59,0,0,0-.41.59.57.57,0,0,0,.43.52l4,1.24,1.61,4.83a.62.62,0,0,0,.63.43.56.56,0,0,0,.4-.17L16.54,20l4.09,3A.9.9,0,0,0,21.11,23.15ZM13.8,20.71l-1.21-4q8.72-5.55,8.78-5.55c.15,0,.23,0,.23.16a.18.18,0,0,1,0,.06s-2.51,2.3-7.52,6.8Z" /> </svg> </a> + {{- end }} </div> diff --git a/themes/PaperMod/layouts/partials/social_icons.html b/themes/PaperMod/layouts/partials/social_icons.html @@ -1,6 +1,7 @@ <div class="social-icons"> - {{- range . -}} - <a href="{{ trim .url " " }}" target="_blank" rel="noopener noreferrer me" - title="{{ .name | humanize }}">{{ partial "svg.html" . }}</a> - {{- end -}} + {{- range . }} + <a href="{{ trim .url " " }}" target="_blank" rel="noopener noreferrer me" title="{{ .name | title }}"> + {{ partial "svg.html" . }} + </a> + {{- end }} </div> diff --git a/themes/PaperMod/layouts/partials/svg.html b/themes/PaperMod/layouts/partials/svg.html @@ -1,4 +1,4 @@ -{{ $icon_name := ( trim .name " " | lower )}} +{{- $icon_name := ( trim .name " " | lower )}} {{- if (eq $icon_name "123rf") -}} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> @@ -91,6 +91,15 @@ -28 26 -27 27 65 66 65 66 -100 101 c-55 55 -100 99 -100 97z" /> </g> </svg> +{{- else if (eq $icon_name "cv") -}} +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" + stroke-linecap="round" stroke-linejoin="round"> + <path + d="M4 4v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.342a2 2 0 0 0-.602-1.43l-4.44-4.342A2 2 0 0 0 13.56 2H6a2 2 0 0 0-2 2z" /> + <path d="M9 13h6" /> + <path d="M9 17h3" /> + <path d="M14 2v4a2 2 0 0 0 2 2h4" /> +</svg> {{- else if (eq $icon_name "dev") -}} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="none"> <path @@ -126,7 +135,7 @@ d="M8.533 3.208s2.888 2.73 5.339 9.235c2.451 6.505 2.344 8.4 2.344 8.4" /> </svg> {{- else if (eq $icon_name "email") -}} -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 21" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path> <polyline points="22,6 12,13 2,6"></polyline> @@ -136,6 +145,11 @@ stroke-linecap="round" stroke-linejoin="round"> <path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"></path> </svg> +{{- else if (eq $icon_name "flickr") -}} +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"> + <path + d="M5.334 6.666C2.3884 6.666 0 9.055 0 12c0 2.9456 2.3884 5.334 5.334 5.334 2.9456 0 5.332-2.3884 5.332-5.334 0-2.945-2.3864-5.334-5.332-5.334zm13.332 0c-2.9456 0-5.332 2.389-5.332 5.334 0 2.9456 2.3864 5.334 5.332 5.334C21.6116 17.334 24 14.9456 24 12c0-2.945-2.3884-5.334-5.334-5.334Z" /> +</svg> {{- else if (eq $icon_name "freepik") -}} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> @@ -167,6 +181,22 @@ d="M22.65 14.39L12 22.13 1.35 14.39a.84.84 0 0 1-.3-.94l1.22-3.78 2.44-7.51A.42.42 0 0 1 4.82 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.49h8.1l2.44-7.51A.42.42 0 0 1 18.6 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.51L23 13.45a.84.84 0 0 1-.35.94z"> </path> </svg> +{{- else if (eq $icon_name "goodreads") -}} +<svg xmlns="http://www.w3.org/2000/svg" role="img" fill="currentColor" viewBox="0 0 24 24"> + <path + d="M11.43 23.995c-3.608-.208-6.274-2.077-6.448-5.078.695.007 1.375-.013 2.07-.006.224 1.342 1.065 2.43 2.683 3.026 1.583.496 3.737.46 5.082-.174 1.351-.636 2.145-1.822 2.503-3.577.212-1.042.236-1.734.231-2.92l-.005-1.631h-.059c-1.245 2.564-3.315 3.53-5.59 3.475-5.74-.054-7.68-4.534-7.528-8.606.01-5.241 3.22-8.537 7.557-8.495 2.354-.14 4.605 1.362 5.554 3.37l.059.002.002-2.918 2.099.004-.002 15.717c-.193 7.04-4.376 7.89-8.209 7.811zm6.1-15.633c-.096-3.26-1.601-6.62-5.503-6.645-3.954-.017-5.625 3.592-5.604 6.85-.013 3.439 1.643 6.305 4.703 6.762 4.532.591 6.551-3.411 6.404-6.967z" /> +</svg> +{{- else if (eq $icon_name "googlescholar") -}} +<svg role="img" viewBox="0 0 24 25" xmlns="http://www.w3.org/2000/svg" fill="currentColor" stroke="none" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> + <path + d="M5.242 13.769L0 9.5 12 0l12 9.5-5.242 4.269C17.548 11.249 14.978 9.5 12 9.5c-2.977 0-5.548 1.748-6.758 4.269zM12 10a7 7 0 1 0 0 14 7 7 0 0 0 0-14z" /> +</svg> +{{- else if (eq $icon_name "hackerone") -}} +<svg role="img" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> + <path + d="M7.207 0c-.4836 0-.8774.1018-1.1823.3002-.3044.2003-.4592.4627-.4592.7798v21.809c0 .2766.1581.5277.4752.7609.315.2335.7031.3501 1.1664.3501.4427 0 .8306-.1166 1.1678-.3501.3352-.231.5058-.4843.5058-.761V1.0815c0-.319-.1623-.5769-.4893-.7813C8.0644.1018 7.6702 0 7.207 0zm9.5234 8.662c-.4836 0-.8717.0981-1.1683.3007l-4.439 2.7822c-.1988.1861-.2841.4687-.2473.855.0342.3826.2108.747.5238 1.0907.3145.346.6662.5626 1.0684.6547.3963.0899.6973.041.8962-.143l1.7551-1.0951v9.7817c0 .2767.1522.5278.4607.761.3007.2335.6873.3501 1.1504.3501.463 0 .863-.1166 1.1983-.3501.3371-.2332.5058-.4843.5058-.761V9.7381c0-.3193-.165-.577-.4898-.7754-.3252-.2026-.7288-.3007-1.2143-.3007z" /> +</svg> {{- else if (eq $icon_name "hackerrank") -}} <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="0 0 50 35" fill="currentColor" stroke-width="0" stroke="currentColor"> @@ -181,10 +211,10 @@ </svg> {{- else if (eq $icon_name "hackthebox") -}} <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" - preserveAspectRatio="xMidYMid meet" viewBox="0 0 64 64" fill="currentColor" stroke="currentColor"> + preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" fill="currentColor" stroke="none"> <g> <path - d="M4.63 15.53L4.63 31.85L4.63 48.27L18.36 56.14L32 64L45.74 56.14L59.37 48.17L59.37 31.95L59.37 15.63C51.31 10.97 46.83 8.38 45.93 7.86C38.57 3.58 32.3 0 32 0C31.7 0 25.43 3.48 18.07 7.76C16.27 8.8 11.79 11.39 4.63 15.53ZM49.62 17.32C49.12 18.71 33.79 27.77 32 27.77C30.21 27.77 14.88 18.71 14.38 17.32C14.18 16.62 30.01 6.27 31.8 5.97C31.9 5.97 36.08 8.36 40.96 11.15C45.93 14.03 49.82 16.82 49.62 17.32ZM29.01 33.84C29.01 40.11 29.01 43.6 29.01 44.29C29.01 51.36 28.62 54.74 27.92 54.74C27.32 54.74 23.04 52.65 18.46 50.07C17.91 49.75 15.12 48.15 10.1 45.29L10.1 34.04L10.1 22.79C13.57 24.7 15.49 25.77 15.88 25.98C18.96 27.77 23.24 30.26 25.33 31.55C25.82 31.86 27.05 32.62 29.01 33.84ZM36.08 54.74C35.28 54.74 34.99 51.66 35.19 44.09C35.2 43.38 35.3 39.83 35.48 33.44L44.44 28.17L53.4 22.99C53.7 29.08 53.86 32.47 53.9 33.14C54.2 38.72 54.3 43.7 54.1 44.29C53.8 45.49 37.77 54.74 36.08 54.74Z"> + d="M11.9959.0008a1.1187 1.1187 0 00-.057.002.8993.8993 0 00-.2358.0498.9067.9067 0 00-.1652.079L1.9357 5.675a.889.889 0 00-.4444.7699c0 .006.0004.0128.0006.0192-.0002.007 0 .014 0 .0212V17.556a.889.889 0 00.469.7837l9.5983 5.5416c.018.0102.036.0197.054.0287v.002a.8568.8568 0 00.083.0348c0 .001.01.003.012.004.028.01.056.0177.085.0245.01.001.011.003.016.004.028.006.057.0112.086.0146 0 .0005.01.0009.014.001.03.003.061.005.091.005s.061-.002.091-.005c0-.0005.01-.0009.014-.001a.6831.6831 0 00.086-.0146c.01-.001.011-.002.016-.004a.9404.9404 0 00.085-.0245c0-.001.01-.003.012-.004a.8818.8818 0 00.083-.0347v-.002a1.086 1.086 0 00.054-.0287l9.5986-5.5416a.889.889 0 00.4689-.7837V6.4786c0-.009-.0006-.0172-.0008-.0258h.0003v-.008a.8886.8886 0 00-.3117-.6755c-.01-.008-.019-.0162-.029-.0241 0-.002-.01-.005-.01-.007a.8988.8988 0 00-.1074-.0705L12.4533.1267a.8872.8872 0 00-.4646-.1266zm.01 2.2523c.072 0 .1443.0187.209.056l6.5366 3.774c.2789.161.2789.5633 0 .7243l-6.5367 3.774a.4182.4182 0 01-.4182 0L5.26 6.8074c-.2788-.1609-.2789-.5633 0-.7243l6.5368-3.774a.4193.4193 0 01.209-.056zm-8.0801 6.458a.4145.4145 0 01.215.0565l6.524 3.7666a.417.417 0 01.2086.3612v7.5326c0 .3212-.3477.522-.626.3613l-6.5237-3.7666a.4172.4172 0 01-.2086-.3613V9.1288c0-.2408.1955-.414.4107-.4177zm16.1599 0c.215.004.4107.1768.4107.4177v7.5325c0 .149-.08.2868-.2087.3614l-6.5239 3.7666c-.278.1606-.6258-.0401-.6258-.3614v-7.5325c0-.149.08-.2867.2086-.3613l6.5238-3.7666a.415.415 0 01.2152-.0565z"> </path> </g> </svg> @@ -229,6 +259,15 @@ <path d="M10.599 17.211l-.881-2.393s-1.433 1.596-3.579 1.596c-1.9 0-3.249-1.652-3.249-4.296 0-3.385 1.708-4.596 3.388-4.596 2.418 0 3.184 1.568 3.845 3.578l.871 2.751c.871 2.672 2.523 4.818 7.285 4.818 3.41 0 5.722-1.045 5.722-3.801 0-2.227-1.276-3.383-3.635-3.935l-1.757-.384c-1.217-.274-1.577-.771-1.577-1.597 0-.936.736-1.487 1.952-1.487 1.323 0 2.028.495 2.147 1.679l2.749-.33c-.225-2.479-1.937-3.494-4.745-3.494-2.479 0-4.897.936-4.897 3.934 0 1.873.902 3.058 3.185 3.605l1.862.443c1.397.33 1.863.916 1.863 1.713 0 1.021-.992 1.441-2.869 1.441-2.779 0-3.936-1.457-4.597-3.469l-.901-2.75c-1.156-3.574-3.004-4.896-6.669-4.896C2.147 5.327 0 7.879 0 12.235c0 4.179 2.147 6.445 6.003 6.445 3.108 0 4.596-1.457 4.596-1.457v-.012z" /> </svg> +{{- else if (eq $icon_name "liberapay") -}} +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" fill="currentColor"> + <g transform="translate(-78.37-208.06)"> + <path + d="m104.28 271.1c-3.571 0-6.373-.466-8.41-1.396-2.037-.93-3.495-2.199-4.375-3.809-.88-1.609-1.308-3.457-1.282-5.544.025-2.086.313-4.311.868-6.675l9.579-40.05 11.69-1.81-10.484 43.44c-.202.905-.314 1.735-.339 2.489-.026.754.113 1.421.415 1.999.302.579.817 1.044 1.546 1.395.729.353 1.747.579 3.055.679l-2.263 9.278" /> + <path + d="m146.52 246.14c0 3.671-.604 7.03-1.811 10.07-1.207 3.043-2.879 5.669-5.01 7.881-2.138 2.213-4.702 3.935-7.693 5.167-2.992 1.231-6.248 1.848-9.767 1.848-1.71 0-3.42-.151-5.129-.453l-3.394 13.651h-11.162l12.52-52.19c2.01-.603 4.311-1.143 6.901-1.622 2.589-.477 5.393-.716 8.41-.716 2.815 0 5.242.428 7.278 1.282 2.037.855 3.708 2.024 5.02 3.507 1.307 1.484 2.274 3.219 2.904 5.205.627 1.987.942 4.11.942 6.373m-27.378 15.461c.854.202 1.91.302 3.167.302 1.961 0 3.746-.364 5.355-1.094 1.609-.728 2.979-1.747 4.111-3.055 1.131-1.307 2.01-2.877 2.64-4.714.628-1.835.943-3.858.943-6.071 0-2.161-.479-3.998-1.433-5.506-.956-1.508-2.615-2.263-4.978-2.263-1.61 0-3.118.151-4.525.453l-5.28 21.948" /> + </g> +</svg> {{- else if (eq $icon_name "linkedin") -}} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> @@ -246,6 +285,11 @@ d="M17.832 8.633v5h-1.978V8.78c0-1.023-.43-1.542-1.29-1.542-.95 0-1.427.616-1.427 1.834v2.655H11.17V9.072c0-1.218-.476-1.834-1.427-1.834-.86 0-1.29.52-1.29 1.542v4.852H6.475V8.633c0-1.022.26-1.834.782-2.434.538-.6 1.243-.909 2.118-.909 1.012 0 1.779.39 2.286 1.169l.492.827.493-.827c.507-.78 1.274-1.169 2.286-1.169.875 0 1.58.308 2.118.909.522.6.782 1.412.782 2.434" fill="currentColor" stroke="none" /> </svg> +{{- else if (eq $icon_name "matrix") -}} +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"> + <path + d="M.632.55v22.9H2.28V24H0V0h2.28v.55zm7.043 7.26v1.157h.033c.309-.443.683-.784 1.117-1.024.433-.245.936-.365 1.5-.365.54 0 1.033.107 1.481.314.448.208.785.582 1.02 1.108.254-.374.6-.706 1.034-.992.434-.287.95-.43 1.546-.43.453 0 .872.056 1.26.167.388.11.716.286.993.53.276.245.489.559.646.951.152.392.23.863.23 1.417v5.728h-2.349V11.52c0-.286-.01-.559-.032-.812a1.755 1.755 0 0 0-.18-.66 1.106 1.106 0 0 0-.438-.448c-.194-.11-.457-.166-.785-.166-.332 0-.6.064-.803.189a1.38 1.38 0 0 0-.48.499 1.946 1.946 0 0 0-.231.696 5.56 5.56 0 0 0-.06.785v4.768h-2.35v-4.8c0-.254-.004-.503-.018-.752a2.074 2.074 0 0 0-.143-.688 1.052 1.052 0 0 0-.415-.503c-.194-.125-.476-.19-.854-.19-.111 0-.259.024-.439.074-.18.051-.36.143-.53.282-.171.138-.319.337-.439.595-.12.259-.18.6-.18 1.02v4.966H5.46V7.81zm15.693 15.64V.55H21.72V0H24v24h-2.28v-.55z" /> +</svg> {{- else if (eq $icon_name "medium") -}} <svg version="1.0" xmlns="http://www.w3.org/2000/svg" fill="currentColor" stroke-width="2" viewBox="0 0 76.000000 76.000000" preserveAspectRatio="xMidYMid meet"> @@ -278,6 +322,18 @@ d="M7.144 19.532l1.049-5.751c.11-.606.691-1.002 1.304-.948 2.155.192 6.877.1 8.818-4.002 2.554-5.397-.59-7.769-6.295-7.769H7.43a1.97 1.97 0 0 0-1.944 1.655L2.77 19.507a.857.857 0 0 0 .846.994h2.368a1.18 1.18 0 0 0 1.161-.969zM7.967 22.522a.74.74 0 0 0 .666.416h2.313c.492 0 .923-.351 1.003-.837l.759-4.601c.095-.523.597-.866 1.127-.819 1.86.166 5.567-.118 6.85-3.821.554-1.6.705-2.954.408-4.018" style="font-variation-settings:normal" stroke="currentColor" stroke-linejoin="miter" /> </svg> +{{- else if (eq $icon_name "phone") -}} +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <rect x="9" y="4" width="6" height="1" rx="0.5" fill="currentColor"/> + <path d="M12 20C12.2652 20 12.5196 19.8946 12.7071 19.7071C12.8946 19.5196 13 19.2652 13 19C13 18.7348 12.8946 18.4804 12.7071 18.2929C12.5196 18.1054 12.2652 18 12 18C11.7348 18 11.4804 18.1054 11.2929 18.2929C11.1054 18.4804 11 18.7348 11 19C11 19.2652 11.1054 19.5196 11.2929 19.7071C11.4804 19.8946 11.7348 20 12 20Z" fill="currentColor"/> + <rect x="5" y="1" width="14" height="22" rx="2" stroke="currentColor" stroke-width="2"/> +</svg> +{{- else if (eq $icon_name "polywork") -}} +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" + fill="currentColor" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"> + <path + d="M19.125 0H4.875A4.865 4.865 0 0 0 0 4.875v14.25C0 21.825 2.175 24 4.875 24h6.6c2.7 0 4.875-2.175 4.875-4.875V16.65h2.775c2.7 0 4.875-2.175 4.875-4.875v-6.9C24 2.175 21.825 0 19.125 0zM16.5 1.275h2.625a3.6 3.6 0 0 1 3.6 3.6v2.7H16.5v-6.3zM15.075 9v6.45H8.85V9h6.225zM8.85 1.2h6.225v6.375H8.85V1.2zM1.275 4.8a3.6 3.6 0 0 1 3.6-3.6H7.5v6.375H1.275V4.8zM7.5 9v6.45H1.2V9h6.3zm0 13.725H4.8a3.6 3.6 0 0 1-3.6-3.6V16.8h6.3v5.925zm7.575-3.525a3.6 3.6 0 0 1-3.6 3.6H8.85v-5.925h6.225V19.2zm7.65-7.35a3.6 3.6 0 0 1-3.6 3.6H16.5V9h6.225v2.85z" /> +</svg> {{- else if (eq $icon_name "qq") -}} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> @@ -290,6 +346,12 @@ <path d="M24 11.779c0-1.459-1.192-2.645-2.657-2.645-.715 0-1.363.286-1.84.746-1.81-1.191-4.259-1.949-6.971-2.046l1.483-4.669 4.016.941-.006.058c0 1.193.975 2.163 2.174 2.163 1.198 0 2.172-.97 2.172-2.163s-.975-2.164-2.172-2.164c-.92 0-1.704.574-2.021 1.379l-4.329-1.015c-.189-.046-.381.063-.44.249l-1.654 5.207c-2.838.034-5.409.798-7.3 2.025-.474-.438-1.103-.712-1.799-.712-1.465 0-2.656 1.187-2.656 2.646 0 .97.533 1.811 1.317 2.271-.052.282-.086.567-.086.857 0 3.911 4.808 7.093 10.719 7.093s10.72-3.182 10.72-7.093c0-.274-.029-.544-.075-.81.832-.447 1.405-1.312 1.405-2.318zm-17.224 1.816c0-.868.71-1.575 1.582-1.575.872 0 1.581.707 1.581 1.575s-.709 1.574-1.581 1.574-1.582-.706-1.582-1.574zm9.061 4.669c-.797.793-2.048 1.179-3.824 1.179l-.013-.003-.013.003c-1.777 0-3.028-.386-3.824-1.179-.145-.144-.145-.379 0-.523.145-.145.381-.145.526 0 .65.647 1.729.961 3.298.961l.013.003.013-.003c1.569 0 2.648-.315 3.298-.962.145-.145.381-.144.526 0 .145.145.145.379 0 .524zm-.189-3.095c-.872 0-1.581-.706-1.581-1.574 0-.868.709-1.575 1.581-1.575s1.581.707 1.581 1.575-.709 1.574-1.581 1.574z" /> </svg> +{{- else if (eq $icon_name "researchgate") -}} +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor" stroke="none" + stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> + <path + d="M19.586 0c-.818 0-1.508.19-2.073.565-.563.377-.97.936-1.213 1.68a3.193 3.193 0 0 0-.112.437 8.365 8.365 0 0 0-.078.53 9 9 0 0 0-.05.727c-.01.282-.013.621-.013 1.016a31.121 31.123 0 0 0 .014 1.017 9 9 0 0 0 .05.727 7.946 7.946 0 0 0 .077.53h-.005a3.334 3.334 0 0 0 .113.438c.245.743.65 1.303 1.214 1.68.565.376 1.256.564 2.075.564.8 0 1.536-.213 2.105-.603.57-.39.94-.916 1.175-1.65.076-.235.135-.558.177-.93a10.9 10.9 0 0 0 .043-1.207v-.82c0-.095-.047-.142-.14-.142h-3.064c-.094 0-.14.047-.14.141v.956c0 .094.046.14.14.14h1.666c.056 0 .084.03.084.086 0 .36 0 .62-.036.865-.038.244-.1.447-.147.606-.108.385-.348.664-.638.876-.29.212-.738.35-1.227.35-.545 0-.901-.15-1.21-.353-.306-.203-.517-.454-.67-.915a3.136 3.136 0 0 1-.147-.762 17.366 17.367 0 0 1-.034-.656c-.01-.26-.014-.572-.014-.939a26.401 26.403 0 0 1 .014-.938 15.821 15.822 0 0 1 .035-.656 3.19 3.19 0 0 1 .148-.76 1.89 1.89 0 0 1 .742-1.01c.344-.244.593-.352 1.137-.352.508 0 .815.096 1.144.303.33.207.528.492.764.925.047.094.111.118.198.07l1.044-.43c.075-.048.09-.115.042-.199a3.549 3.549 0 0 0-.466-.742 3 3 0 0 0-.679-.607 3.313 3.313 0 0 0-.903-.41A4.068 4.068 0 0 0 19.586 0zM8.217 5.836c-1.69 0-3.036.086-4.297.086-1.146 0-2.291 0-3.007-.029v.831l1.088.2c.744.144 1.174.488 1.174 2.264v11.288c0 1.777-.43 2.12-1.174 2.263l-1.088.2v.832c.773-.029 2.12-.086 3.465-.086 1.29 0 2.951.057 3.667.086v-.831l-1.49-.2c-.773-.115-1.174-.487-1.174-2.264v-4.784c.688.057 1.29.057 2.206.057 1.748 3.123 3.41 5.472 4.355 6.56.86 1.032 2.177 1.691 3.839 1.691.487 0 1.003-.086 1.318-.23v-.744c-1.031 0-2.063-.716-2.808-1.518-1.26-1.376-2.95-3.582-4.355-6.074 2.32-.545 4.04-2.722 4.04-4.9 0-3.208-2.492-4.698-5.758-4.698zm-.515 1.29c2.406 0 3.839 1.26 3.839 3.552 0 2.263-1.547 3.782-4.097 3.782-.974 0-1.404-.03-2.063-.086v-7.19c.66-.059 1.547-.059 2.32-.059z" /> +</svg> {{- else if (eq $icon_name "rss") -}} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> @@ -297,6 +359,11 @@ <path d="M4 4a16 16 0 0 1 16 16" /> <circle cx="5" cy="19" r="1" /> </svg> +{{- else if (eq $icon_name "serverfault") -}} +<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"> + <path + d="M24 18.185v2.274h-4.89v-2.274H24zm-24-.106h11.505v2.274H0v-2.279.005zm12.89 0h4.89v2.274h-4.89v-2.279.005zm6.221-3.607H24v2.274h-4.89l.001-2.274zM0 14.367h11.505v2.274H0v-2.274zm12.89 0h4.89v2.274h-4.89v-2.274zm6.221-3.346H24v2.273h-4.89l.001-2.273zM0 10.916h11.505v2.271H0v-2.271zm12.89 0h4.89v2.271h-4.89v-2.271zm6.22-3.609H24v2.279h-4.89V7.307zM0 7.206h11.505V9.48H0V7.201v.005zm12.89 0h4.89V9.48h-4.89V7.201v.005zm6.221-3.556H24v2.276h-4.89v-2.28l.001.004zM0 3.541h11.505v2.274H0V3.541zm12.89 0h4.89v2.274h-4.89V3.541z" /> +</svg> {{- else if (eq $icon_name "soundcloud") -}} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="none"> <path @@ -345,6 +412,11 @@ d="M826 319 c-42 -33 -56 -71 -56 -149 0 -121 36 -170 125 -170 90 0 128 49 129 165 0 118 -43 175 -132 175 -25 0 -49 -8 -66 -21z m99 -63 c27 -19 34 -126 11 -161 -18 -27 -56 -34 -74 -12 -28 34 -26 142 4 172 19 19 35 19 59 1z" /> </g> </svg> +{{- else if (eq $icon_name "spotify") -}} +<svg fill="currentColor" stoke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> + <path + d="M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z" /> +</svg> {{- else if (eq $icon_name "stackoverflow") -}} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> @@ -380,6 +452,24 @@ d="M37.892,13.5h-4.486 l-1.143-3.306C31.707,8.581,30.189,7.5,28.483,7.5h-9.045c-1.706,0-3.224,1.081-3.781,2.694L14.515,13.5H9.108 c-2.545,0-4.608,2.063-4.608,4.608v16.785c0,2.545,2.063,4.608,4.608,4.608h28.785c2.545,0,4.608-2.063,4.608-4.608V18.108 C42.5,15.563,40.437,13.5,37.892,13.5z" /> <circle cx="24" cy="26" r="7.5" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="4" /> </svg> +{{- else if (eq $icon_name "xda") -}} +<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"> + <path + d="M13.84 3.052V0h7.843v17.583H13.84v-3.024h4.591V3.052zM5.569 14.53V3.024h4.592V0H2.318v17.583H6.98L10.16 24v-9.483z" /> +</svg> +{{- else if (eq $icon_name "xing") -}} +<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" fill="currentColor"> + <path + d="M313.8 303.9L469 32H365L209.4 303.8a1.35 1.35 0 0 0 0 1.7l98.9 173.8c.4.7.8.7 1.6.7H413l-99.3-174.7a1.74 1.74 0 0 1 .1-1.4z" + fill="currentColor" /> + <path + d="M221.9 216.2L163 113a2 2 0 0 0-2-1H65l58.9 104.4a1.13 1.13 0 0 1 .1.8L43 352h96.8a1.54 1.54 0 0 0 1.6-.9l80.5-133.7a2.44 2.44 0 0 0 0-1.2z" /> +</svg> +{{- else if (eq $icon_name "ycombinator") -}} +<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor" stroke="none" stroke-width="1"> + <path + d="M0 24V0h24v24H0zM6.951 5.896l4.112 7.708v5.064h1.583v-4.972l4.148-7.799h-1.749l-2.457 4.875c-.372.745-.688 1.434-.688 1.434s-.297-.708-.651-1.434L8.831 5.896h-1.88z" /> +</svg> {{- else if (eq $icon_name "youtube") -}} <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> diff --git a/themes/PaperMod/layouts/partials/templates/opengraph.html b/themes/PaperMod/layouts/partials/templates/opengraph.html @@ -29,14 +29,6 @@ <meta property="article:section" content="{{ .Section }}" /> {{ with .PublishDate }}<meta property="article:published_time" content="{{ .Format $iso8601 }}" />{{ end }} {{ with .Lastmod }}<meta property="article:modified_time" content="{{ .Format $iso8601 }}" />{{ end }} - -{{- range .Site.Authors }} -{{ with .Social.facebook }}<meta property="article:author" content="https://www.facebook.com/{{ . }}" />{{ end }} -{{ with .Site.Social.facebook }}<meta property="article:publisher" content="https://www.facebook.com/{{ . }}" />{{ end }} -{{- with .Params.tags }}{{ range first 6 . }} -<meta property="article:tag" content="{{ . }}" /> -{{- end }}{{ end -}} -{{- end -}} {{- end -}} {{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }} diff --git a/themes/PaperMod/layouts/partials/templates/schema_json.html b/themes/PaperMod/layouts/partials/templates/schema_json.html @@ -2,7 +2,7 @@ <script type="application/ld+json"> { "@context": "https://schema.org", - "@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | humanize -}}", + "@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | title -}}", "name": {{ .Site.Title }}, "url": {{ .Site.BaseURL }}, "description": {{ .Site.Params.description | plainify | truncate 180 | safeHTML }}, @@ -105,7 +105,7 @@ "@id": {{ .Permalink | safeHTML }} }, "publisher": { - "@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | humanize -}}", + "@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | title -}}", "name": {{ .Site.Title }}, "logo": { "@type": "ImageObject", @@ -114,6 +114,6 @@ } } </script> -{{ end }}{{/* .IsPage end */}} +{{- end }}{{/* .IsPage end */}} -{{ end }} +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/templates/twitter_cards.html b/themes/PaperMod/layouts/partials/templates/twitter_cards.html @@ -31,8 +31,3 @@ {{ with .Site.Social.twitter -}} <meta name="twitter:site" content="@{{ . }}"/> {{ end -}} -{{ range .Site.Authors }} -{{ with .twitter -}} -<meta name="twitter:creator" content="@{{ . }}"/> -{{ end -}} -{{ end -}}- \ No newline at end of file diff --git a/themes/PaperMod/layouts/partials/toc.html b/themes/PaperMod/layouts/partials/toc.html @@ -1,84 +1,93 @@ {{- $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content -}} {{- $has_headers := ge (len $headers) 1 -}} {{- if $has_headers -}} +<div class="toc"> + <details {{if (.Param "TocOpen") }} open{{ end }}> + <summary accesskey="c" title="(Alt + C)"> + <span class="details">{{- i18n "toc" | default "Table of Contents" }}</span> + </summary> -{{- $largest := 6 -}} -{{- range $headers -}} -{{- $headerLevel := index (findRE "[1-6]" . 1) 0 -}} -{{- $headerLevel := len (seq $headerLevel) -}} -{{- if lt $headerLevel $largest -}} -{{- $largest = $headerLevel -}} -{{- end -}} -{{- end -}} + <div class="inner"> + {{- $largest := 6 -}} + {{- range $headers -}} + {{- $headerLevel := index (findRE "[1-6]" . 1) 0 -}} + {{- $headerLevel := len (seq $headerLevel) -}} + {{- if lt $headerLevel $largest -}} + {{- $largest = $headerLevel -}} + {{- end -}} + {{- end -}} -{{- $firstHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers 0) 1) 0)) -}} + {{- $firstHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers 0) 1) 0)) -}} -{{- $.Scratch.Set "bareul" slice -}} -<ul> - {{- range seq (sub $firstHeaderLevel $largest) -}} - <ul> - {{- $.Scratch.Add "bareul" (sub (add $largest .) 1) -}} - {{- end -}} - {{- range $i, $header := $headers -}} - {{- $headerLevel := index (findRE "[1-6]" . 1) 0 -}} - {{- $headerLevel := len (seq $headerLevel) -}} + {{- $.Scratch.Set "bareul" slice -}} + <ul> + {{- range seq (sub $firstHeaderLevel $largest) -}} + <ul> + {{- $.Scratch.Add "bareul" (sub (add $largest .) 1) -}} + {{- end -}} + {{- range $i, $header := $headers -}} + {{- $headerLevel := index (findRE "[1-6]" . 1) 0 -}} + {{- $headerLevel := len (seq $headerLevel) -}} - {{/* get id="xyz" */}} - {{- $id := index (findRE "(id=\"(.*?)\")" $header 9) 0 }} + {{/* get id="xyz" */}} + {{- $id := index (findRE "(id=\"(.*?)\")" $header 9) 0 }} - {{- /* strip id="" to leave xyz, no way to get regex capturing groups in hugo */ -}} - {{- $cleanedID := replace (replace $id "id=\"" "") "\"" "" }} - {{- $header := replaceRE "<h[1-6].*?>((.|\n])+?)</h[1-6]>" "$1" $header -}} + {{- /* strip id="" to leave xyz, no way to get regex capturing groups in hugo */ -}} + {{- $cleanedID := replace (replace $id "id=\"" "") "\"" "" }} + {{- $header := replaceRE "<h[1-6].*?>((.|\n])+?)</h[1-6]>" "$1" $header -}} - {{- if ne $i 0 -}} - {{- $prevHeaderLevel := index (findRE "[1-6]" (index $headers (sub $i 1)) 1) 0 -}} - {{- $prevHeaderLevel := len (seq $prevHeaderLevel) -}} - {{- if gt $headerLevel $prevHeaderLevel -}} - {{- range seq $prevHeaderLevel (sub $headerLevel 1) -}} - <ul> - {{/* the first should not be recorded */}} - {{- if ne $prevHeaderLevel . -}} - {{- $.Scratch.Add "bareul" . -}} - {{- end -}} - {{- end -}} - {{- else -}} + {{- if ne $i 0 -}} + {{- $prevHeaderLevel := index (findRE "[1-6]" (index $headers (sub $i 1)) 1) 0 -}} + {{- $prevHeaderLevel := len (seq $prevHeaderLevel) -}} + {{- if gt $headerLevel $prevHeaderLevel -}} + {{- range seq $prevHeaderLevel (sub $headerLevel 1) -}} + <ul> + {{/* the first should not be recorded */}} + {{- if ne $prevHeaderLevel . -}} + {{- $.Scratch.Add "bareul" . -}} + {{- end -}} + {{- end -}} + {{- else -}} + </li> + {{- if lt $headerLevel $prevHeaderLevel -}} + {{- range seq (sub $prevHeaderLevel 1) -1 $headerLevel -}} + {{- if in ($.Scratch.Get "bareul") . -}} + </ul> + {{/* manually do pop item */}} + {{- $tmp := $.Scratch.Get "bareul" -}} + {{- $.Scratch.Delete "bareul" -}} + {{- $.Scratch.Set "bareul" slice}} + {{- range seq (sub (len $tmp) 1) -}} + {{- $.Scratch.Add "bareul" (index $tmp (sub . 1)) -}} + {{- end -}} + {{- else -}} + </ul> + </li> + {{- end -}} + {{- end -}} + {{- end -}} + {{- end }} + <li> + <a href="#{{- $cleanedID -}}" aria-label="{{- $header | plainify -}}">{{- $header | safeHTML -}}</a> + {{- else }} + <li> + <a href="#{{- $cleanedID -}}" aria-label="{{- $header | plainify -}}">{{- $header | safeHTML -}}</a> + {{- end -}} + {{- end -}} + <!-- {{- $firstHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers 0) 1) 0)) -}} --> + {{- $firstHeaderLevel := $largest }} + {{- $lastHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers (sub (len $headers) 1)) 1) 0)) }} + </li> + {{- range seq (sub $lastHeaderLevel $firstHeaderLevel) -}} + {{- if in ($.Scratch.Get "bareul") (add . $firstHeaderLevel) }} + </ul> + {{- else }} + </ul> </li> - {{- if lt $headerLevel $prevHeaderLevel -}} - {{- range seq (sub $prevHeaderLevel 1) -1 $headerLevel -}} - {{- if in ($.Scratch.Get "bareul") . -}} - </ul> - {{/* manually do pop item */}} - {{- $tmp := $.Scratch.Get "bareul" -}} - {{- $.Scratch.Delete "bareul" -}} - {{- $.Scratch.Set "bareul" slice}} - {{- range seq (sub (len $tmp) 1) -}} - {{- $.Scratch.Add "bareul" (index $tmp (sub . 1)) -}} - {{- end -}} - {{- else -}} - </ul> - </li> - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - <li> - <a href="#{{- $cleanedID -}}" aria-label="{{- $header | plainify -}}">{{- $header | safeHTML -}}</a> - {{- else -}} - <li> - <a href="#{{- $cleanedID -}}" aria-label="{{- $header | plainify -}}">{{- $header | safeHTML -}}</a> - {{- end -}} - {{- end -}} - <!-- {{- $firstHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers 0) 1) 0)) -}} --> - {{- $firstHeaderLevel := $largest }} - {{- $lastHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers (sub (len $headers) 1)) 1) 0)) -}} - </li> - {{- range seq (sub $lastHeaderLevel $firstHeaderLevel) -}} - {{- if in ($.Scratch.Get "bareul") (add . $firstHeaderLevel) -}} -</ul> -{{- else -}} -</ul> -</li> -{{- end -}} -{{- end -}} -</ul> -{{- end -}} + {{- end -}} + {{- end }} + </ul> + </div> + </details> +</div> +{{- end }} diff --git a/themes/PaperMod/layouts/partials/translation_list.html b/themes/PaperMod/layouts/partials/translation_list.html @@ -1,19 +1,19 @@ {{- if .IsTranslated -}} -{{- if (ne .Layout "search")}} +{{- if (ne .Layout "search") }} {{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }}&nbsp;|&nbsp;{{- end -}} {{- end }} <ul class="i18n_list"> - {{- i18n "translations" | default "Translations"}}: + {{- i18n "translations" | default "Translations" }}: {{- range .Translations }} <li> <a href="{{ .Permalink }}"> {{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }} - {{- .Language.LanguageName | emojify | humanize -}} + {{- .Language.LanguageName | emojify -}} {{- else }} - {{- .Lang | humanize -}} + {{- .Lang | title -}} {{- end -}} </a> </li> {{- end }} </ul> -{{- end }} +{{- end -}} diff --git a/themes/PaperMod/layouts/shortcodes/collapse.html b/themes/PaperMod/layouts/shortcodes/collapse.html @@ -1,12 +1,8 @@ -{{ if .Get "content" }} {{ if .Get "summary" }} {{ else }} {{ warnf "missing value for param 'summary': %s" .Position }} {{ end }} -{{ else }} -{{ errorf "missing value for param 'content': %s" .Position }} -{{ end }} <p><details {{ if (eq (.Get "openByDefault") true) }} open=true {{ end }}> <summary markdown="span">{{ .Get "summary" | markdownify }}</summary> - {{ .Get "content" | markdownify }} + {{ .Inner | markdownify }} </details></p> diff --git a/themes/PaperMod/theme.toml b/themes/PaperMod/theme.toml @@ -37,7 +37,7 @@ features = [ "scroll-to-top", "search" ] -min_version = "0.74.0" +min_version = "0.83.0" [author] name = "Aditya Telange"