Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Cai <github@jimmycai.com>2022-10-29 18:14:19 +0300
committerGitHub <noreply@github.com>2022-10-29 18:14:19 +0300
commitb03390d237427a2b9cfee55949cb1da62f1a6856 (patch)
treefd7da57cfcebc07d16483f3e9c3d71aee3562138 /layouts/partials
parent8a597a5c9c861d2bce22a5e06c7667cd9c8e263a (diff)
Revert "Merge branch 'canary' into master" (#712)
Revert "Merge branch 'canary' into master (#711)" This reverts commit 8a597a5c9c861d2bce22a5e06c7667cd9c8e263a.
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/article-list/compact.html2
-rw-r--r--layouts/partials/article/components/header.html2
-rw-r--r--layouts/partials/article/components/photoswipe.html88
-rw-r--r--layouts/partials/article/components/related-content.html2
-rw-r--r--layouts/partials/data/title.html7
-rw-r--r--layouts/partials/footer/components/script.html2
-rw-r--r--layouts/partials/footer/footer.html2
-rw-r--r--layouts/partials/head/colorScheme.html4
-rw-r--r--layouts/partials/head/head.html7
-rw-r--r--layouts/partials/head/opengraph/provider/twitter.html2
-rw-r--r--layouts/partials/sidebar/left.html4
-rw-r--r--layouts/partials/widget/archives.html4
12 files changed, 88 insertions, 38 deletions
diff --git a/layouts/partials/article-list/compact.html b/layouts/partials/article-list/compact.html
index edd58a0..376512a 100644
--- a/layouts/partials/article-list/compact.html
+++ b/layouts/partials/article-list/compact.html
@@ -19,7 +19,7 @@
{{- $Width := $image.resource.Width -}}
{{- $Height := $image.resource.Height -}}
- {{- if .Page.Site.Params.imageProcessing.cover.enabled -}}
+ {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
{{- $thumbnail := $image.resource.Fill "120x120" -}}
{{- $Permalink = $thumbnail.RelPermalink -}}
{{- $Width = $thumbnail.Width -}}
diff --git a/layouts/partials/article/components/header.html b/layouts/partials/article/components/header.html
index 78b41bd..7582ec2 100644
--- a/layouts/partials/article/components/header.html
+++ b/layouts/partials/article/components/header.html
@@ -9,7 +9,7 @@
{{- $Height := $image.resource.Height -}}
{{- $Srcset := "" -}}
- {{- if .Page.Site.Params.imageProcessing.cover.enabled -}}
+ {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
{{- $thumbnail := $image.resource.Resize "800x" -}}
{{- $thumbnailRetina := $image.resource.Resize "1600x" -}}
{{- $Srcset = printf "%s 800w, %s 1600w" $thumbnail.RelPermalink $thumbnailRetina.RelPermalink -}}
diff --git a/layouts/partials/article/components/photoswipe.html b/layouts/partials/article/components/photoswipe.html
index 425825c..c33ff49 100644
--- a/layouts/partials/article/components/photoswipe.html
+++ b/layouts/partials/article/components/photoswipe.html
@@ -1,20 +1,68 @@
-{{- $opts := dict "minify" hugo.IsProduction "format" "esm" -}}
-{{- $galleryScript := resources.Get "ts/gallery.ts" | js.Build $opts -}}
-
-<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@5.2.7/dist/photoswipe.css"
- integrity="sha256-olf9rfn3AG8zR6lkPXkN3PZq63z8tElx7Ela6T4eklo=" crossorigin="anonymous">
-
-<script type="module">
- import StackGallery from '{{ $galleryScript.RelPermalink }}';
- import PhotoSwipeLightbox from 'https://cdn.jsdelivr.net/npm/photoswipe@5.2.7/dist/photoswipe-lightbox.esm.min.js';
-
- console.log(StackGallery)
- StackGallery(document.querySelector('.article-content'));
-
- const lightbox = new PhotoSwipeLightbox({
- gallery: '.article-content',
- children: '.gallery-image a',
- pswpModule: () => import('https://cdn.jsdelivr.net/npm/photoswipe@5.2.7/dist/photoswipe.esm.min.js')
- });
- lightbox.init();
-</script> \ No newline at end of file
+<!-- Root element of PhotoSwipe. Must have class pswp. -->
+<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
+
+ <!-- Background of PhotoSwipe.
+ It's a separate element as animating opacity is faster than rgba(). -->
+ <div class="pswp__bg"></div>
+
+ <!-- Slides wrapper with overflow:hidden. -->
+ <div class="pswp__scroll-wrap">
+
+ <!-- Container that holds slides.
+ PhotoSwipe keeps only 3 of them in the DOM to save memory.
+ Don't modify these 3 pswp__item elements, data is added later on. -->
+ <div class="pswp__container">
+ <div class="pswp__item"></div>
+ <div class="pswp__item"></div>
+ <div class="pswp__item"></div>
+ </div>
+
+ <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
+ <div class="pswp__ui pswp__ui--hidden">
+
+ <div class="pswp__top-bar">
+
+ <!-- Controls are self-explanatory. Order can be changed. -->
+
+ <div class="pswp__counter"></div>
+
+ <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
+
+ <button class="pswp__button pswp__button--share" title="Share"></button>
+
+ <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
+
+ <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
+
+ <!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
+ <!-- element will get class pswp__preloader--active when preloader is running -->
+ <div class="pswp__preloader">
+ <div class="pswp__preloader__icn">
+ <div class="pswp__preloader__cut">
+ <div class="pswp__preloader__donut"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
+ <div class="pswp__share-tooltip"></div>
+ </div>
+
+ <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
+ </button>
+
+ <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
+ </button>
+
+ <div class="pswp__caption">
+ <div class="pswp__caption__center"></div>
+ </div>
+
+ </div>
+
+ </div>
+
+</div>
+
+{{- partial "helper/external" (dict "Context" . "Namespace" "PhotoSwipe") -}} \ No newline at end of file
diff --git a/layouts/partials/article/components/related-content.html b/layouts/partials/article/components/related-content.html
index 822fc73..aba88e3 100644
--- a/layouts/partials/article/components/related-content.html
+++ b/layouts/partials/article/components/related-content.html
@@ -1,4 +1,4 @@
-{{ $related := .Site.RegularPages.Related . | first 5 }}
+{{ $related := (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | first 5 }}
{{ with $related }}
<aside class="related-content--wrapper">
<h2 class="section-title">{{ T "article.relatedContent" }}</h2>
diff --git a/layouts/partials/data/title.html b/layouts/partials/data/title.html
index 938a5da..85a7bc7 100644
--- a/layouts/partials/data/title.html
+++ b/layouts/partials/data/title.html
@@ -6,7 +6,9 @@
<!-- Build paginator -->
{{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
- {{ $pag := .Paginate ($pages) }}
+ {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
+ {{ $filtered := ($pages | intersect $notHidden) }}
+ {{ $pag := .Paginate ($filtered) }}
{{ if .Paginator.HasPrev }}
<!-- Paginated. Append page number to title -->
@@ -18,7 +20,8 @@
<!-- Taxonomy page -->
<!-- Build paginator -->
- {{ $pag := .Paginate .Pages }}
+ {{ $notHidden := where .Pages "Params.hidden" "!=" true }}
+ {{ $pag := .Paginate ($notHidden) }}
<!-- {TAXONOMY_TYPE}: {TAXONOMY_TERM} -->
{{ $title = slice (title .Data.Singular) ": " $title }}
diff --git a/layouts/partials/footer/components/script.html b/layouts/partials/footer/components/script.html
index f25dc83..4cb350c 100644
--- a/layouts/partials/footer/components/script.html
+++ b/layouts/partials/footer/components/script.html
@@ -1,3 +1,5 @@
+{{- partial "helper/external" (dict "Context" . "Namespace" "Vibrant") -}}
+
{{- $opts := dict "minify" hugo.IsProduction -}}
{{- $script := resources.Get "ts/main.ts" | js.Build $opts -}}
diff --git a/layouts/partials/footer/footer.html b/layouts/partials/footer/footer.html
index 3b2b46f..49caa89 100644
--- a/layouts/partials/footer/footer.html
+++ b/layouts/partials/footer/footer.html
@@ -1,4 +1,4 @@
-{{- $ThemeVersion := "4.0.0-alpha.0" -}}
+{{- $ThemeVersion := "3.16.0" -}}
<footer class="site-footer">
<section class="copyright">
&copy;
diff --git a/layouts/partials/head/colorScheme.html b/layouts/partials/head/colorScheme.html
index 04d63a5..42f4dd8 100644
--- a/layouts/partials/head/colorScheme.html
+++ b/layouts/partials/head/colorScheme.html
@@ -1,5 +1,5 @@
-{{- $defaultColorScheme := .Site.Params.colorScheme.default -}}
-{{- if not .Site.Params.colorScheme.toggle -}}
+{{- $defaultColorScheme := default "auto" .Site.Params.colorScheme.default -}}
+{{- if not (default false .Site.Params.colorScheme.toggle) -}}
{{/* If toggle is disabled, force default scheme */}}
<script>
(function() {
diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html
index 5de6071..be63710 100644
--- a/layouts/partials/head/head.html
+++ b/layouts/partials/head/head.html
@@ -19,12 +19,7 @@
{{- end -}}
{{ with .Site.Params.favicon }}
- {{ $favicon := resources.Get . }}
- {{ if $favicon }}
- <link rel="shortcut icon" href="{{ $favicon.RelPermalink }}" />
- {{ else }}
- {{ errorf "Failed loading favicon from %q" . }}
- {{ end }}
+ <link rel="shortcut icon" href="{{ . }}" />
{{ end }}
{{- template "_internal/google_analytics.html" . -}}
diff --git a/layouts/partials/head/opengraph/provider/twitter.html b/layouts/partials/head/opengraph/provider/twitter.html
index a837ba3..03bbf22 100644
--- a/layouts/partials/head/opengraph/provider/twitter.html
+++ b/layouts/partials/head/opengraph/provider/twitter.html
@@ -11,6 +11,6 @@
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" -}}
{{- if $image.exists -}}
- <meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}">
+ <meta name="twitter:card" content="{{ default `summary_large_image` .Site.Params.opengraph.twitter.card }}">
<meta name="twitter:image" content='{{ absURL $image.permalink }}' />
{{- end -}} \ No newline at end of file
diff --git a/layouts/partials/sidebar/left.html b/layouts/partials/sidebar/left.html
index 2dfa1d4..f94e50a 100644
--- a/layouts/partials/sidebar/left.html
+++ b/layouts/partials/sidebar/left.html
@@ -7,7 +7,7 @@
<header>
{{ with .Site.Params.sidebar.avatar }}
- {{ if .enabled }}
+ {{ if (default true .enabled) }}
<figure class="site-avatar">
<a href="{{ .Site.BaseURL | relLangURL }}">
{{ if not .local }}
@@ -89,7 +89,7 @@
</li>
{{ end }}
- {{ if .Site.Params.colorScheme.toggle }}
+ {{ if (default false .Site.Params.colorScheme.toggle) }}
<li id="dark-mode-toggle">
{{ partial "helper/icon" "toggle-left" }}
{{ partial "helper/icon" "toggle-right" }}
diff --git a/layouts/partials/widget/archives.html b/layouts/partials/widget/archives.html
index e42da27..1f2abc5 100644
--- a/layouts/partials/widget/archives.html
+++ b/layouts/partials/widget/archives.html
@@ -10,7 +10,9 @@
<h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2>
{{ $pages := where $context.Site.RegularPages "Type" "in" $context.Site.Params.mainSections }}
- {{ $archives := $pages.GroupByDate "2006" }}
+ {{ $notHidden := where $context.Site.RegularPages "Params.hidden" "!=" true }}
+ {{ $filtered := ($pages | intersect $notHidden) }}
+ {{ $archives := $filtered.GroupByDate "2006" }}
<div class="widget-archive--list">
{{ range $index, $item := first (add $limit 1) ($archives) }}