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:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/_markup/render-codeblock.html20
-rw-r--r--layouts/_default/_markup/render-image.html2
-rw-r--r--layouts/_default/archives.html6
-rw-r--r--layouts/_default/list.html2
-rw-r--r--layouts/_default/rss.xml1
-rw-r--r--layouts/index.html5
-rw-r--r--layouts/page/search.json7
-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
19 files changed, 65 insertions, 104 deletions
diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html
new file mode 100644
index 0000000..21c5100
--- /dev/null
+++ b/layouts/_default/_markup/render-codeblock.html
@@ -0,0 +1,20 @@
+{{- $class := .Attributes.class | default "" -}}
+{{- $lang := .Attributes.lang | default .Type -}}
+<div class="codeblock">
+ <header>
+ <span class="codeblock-lang">{{ $lang }}</span>
+ <button
+ class="codeblock-copy"
+ data-id="codeblock-id-{{ .Ordinal }}"
+ data-copied-text="{{ T `article.codeblock.copied` }}"
+ >
+ {{ T `article.codeblock.copy` }}
+ </button>
+ </header>
+ <code id="codeblock-id-{{ .Ordinal }}" style="display:none;">{{- .Inner -}}</code>
+ {{- if transform.CanHighlight $lang -}}
+ <div class="{{ $class }}">{{- highlight .Inner $lang -}}</div>
+ {{- else -}}
+ <pre><code class="{{ $class }}">{{- .Inner -}}</code></pre>
+ {{- end -}}
+</div>
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index 0ed5584..5577736 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -17,7 +17,7 @@
{{- $Height = $image.Height -}}
{{- $galleryImage = true -}}
- {{- if (default true .Page.Site.Params.imageProcessing.content.enabled) -}}
+ {{- if .Page.Site.Params.imageProcessing.content.enabled -}}
{{- $small := $image.Resize `480x` -}}
{{- $big := $image.Resize `1024x` -}}
{{- $Srcset = printf `%s 480w, %s 1024w` $small.RelPermalink $big.RelPermalink -}}
diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html
index 5d5243c..9df633e 100644
--- a/layouts/_default/archives.html
+++ b/layouts/_default/archives.html
@@ -16,10 +16,8 @@
</header>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
- {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
- {{ $filtered := ($pages | intersect $notHidden) }}
-
- {{ range $filtered.GroupByDate "2006" }}
+
+ {{ range $pages.GroupByDate "2006" }}
{{ $id := lower (replace .Key " " "-") }}
<div class="archives-group" id="{{ $id }}">
<h2 class="archives-date section-title"><a href="{{ $.RelPermalink }}#{{ $id }}">{{ .Key }}</a></h2>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 9bc618d..4e1e0b5 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -25,7 +25,7 @@
{{- $Width := $image.resource.Width -}}
{{- $Height := $image.resource.Height -}}
- {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
+ {{- if .Page.Site.Params.imageProcessing.cover.enabled -}}
{{- $thumbnail := $image.resource.Fill "120x120" -}}
{{- $Permalink = $thumbnail.RelPermalink -}}
{{- $Width = $thumbnail.Width -}}
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index e9f3f1a..0d3170e 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -6,7 +6,6 @@
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
-{{- $pages := where $pages "Params.hidden" "!=" true -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
diff --git a/layouts/index.html b/layouts/index.html
index 0cd0b88..5c1eaa5 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,9 +1,6 @@
{{ define "main" }}
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
- {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
- {{ $filtered := ($pages | intersect $notHidden) }}
- {{ $pag := .Paginate ($filtered) }}
-
+ {{ $pag := .Paginate ($pages) }}
<section class="article-list">
{{ range $index, $element := $pag.Pages }}
{{ partial "article-list/default" . }}
diff --git a/layouts/page/search.json b/layouts/page/search.json
index 5d4e627..a0f5184 100644
--- a/layouts/page/search.json
+++ b/layouts/page/search.json
@@ -1,16 +1,13 @@
{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
-{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}}
-{{- $filtered := ($pages | intersect $notHidden) -}}
-
{{- $result := slice -}}
-{{- range $filtered -}}
+{{- range $pages -}}
{{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}}
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
{{- if $image.exists -}}
{{- $imagePermalink := "" -}}
- {{- if and $image.resource (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
+ {{- if and $image.resource .Page.Site.Params.imageProcessing.cover.enabled -}}
{{- $thumbnail := $image.resource.Fill "120x120" -}}
{{- $imagePermalink = (absURL $thumbnail.Permalink) -}}
{{- else -}}
diff --git a/layouts/partials/article-list/compact.html b/layouts/partials/article-list/compact.html
index 376512a..edd58a0 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 (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
+ {{- if .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 7582ec2..78b41bd 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 (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
+ {{- if .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 c33ff49..425825c 100644
--- a/layouts/partials/article/components/photoswipe.html
+++ b/layouts/partials/article/components/photoswipe.html
@@ -1,68 +1,20 @@
-<!-- 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
+{{- $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
diff --git a/layouts/partials/article/components/related-content.html b/layouts/partials/article/components/related-content.html
index aba88e3..822fc73 100644
--- a/layouts/partials/article/components/related-content.html
+++ b/layouts/partials/article/components/related-content.html
@@ -1,4 +1,4 @@
-{{ $related := (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | first 5 }}
+{{ $related := .Site.RegularPages.Related . | 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 85a7bc7..938a5da 100644
--- a/layouts/partials/data/title.html
+++ b/layouts/partials/data/title.html
@@ -6,9 +6,7 @@
<!-- Build paginator -->
{{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
- {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
- {{ $filtered := ($pages | intersect $notHidden) }}
- {{ $pag := .Paginate ($filtered) }}
+ {{ $pag := .Paginate ($pages) }}
{{ if .Paginator.HasPrev }}
<!-- Paginated. Append page number to title -->
@@ -20,8 +18,7 @@
<!-- Taxonomy page -->
<!-- Build paginator -->
- {{ $notHidden := where .Pages "Params.hidden" "!=" true }}
- {{ $pag := .Paginate ($notHidden) }}
+ {{ $pag := .Paginate .Pages }}
<!-- {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 4cb350c..f25dc83 100644
--- a/layouts/partials/footer/components/script.html
+++ b/layouts/partials/footer/components/script.html
@@ -1,5 +1,3 @@
-{{- 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 49caa89..3b2b46f 100644
--- a/layouts/partials/footer/footer.html
+++ b/layouts/partials/footer/footer.html
@@ -1,4 +1,4 @@
-{{- $ThemeVersion := "3.16.0" -}}
+{{- $ThemeVersion := "4.0.0-alpha.0" -}}
<footer class="site-footer">
<section class="copyright">
&copy;
diff --git a/layouts/partials/head/colorScheme.html b/layouts/partials/head/colorScheme.html
index 42f4dd8..04d63a5 100644
--- a/layouts/partials/head/colorScheme.html
+++ b/layouts/partials/head/colorScheme.html
@@ -1,5 +1,5 @@
-{{- $defaultColorScheme := default "auto" .Site.Params.colorScheme.default -}}
-{{- if not (default false .Site.Params.colorScheme.toggle) -}}
+{{- $defaultColorScheme := .Site.Params.colorScheme.default -}}
+{{- if not .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 be63710..5de6071 100644
--- a/layouts/partials/head/head.html
+++ b/layouts/partials/head/head.html
@@ -19,7 +19,12 @@
{{- end -}}
{{ with .Site.Params.favicon }}
- <link rel="shortcut icon" href="{{ . }}" />
+ {{ $favicon := resources.Get . }}
+ {{ if $favicon }}
+ <link rel="shortcut icon" href="{{ $favicon.RelPermalink }}" />
+ {{ else }}
+ {{ errorf "Failed loading favicon from %q" . }}
+ {{ end }}
{{ 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 03bbf22..a837ba3 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="{{ default `summary_large_image` .Site.Params.opengraph.twitter.card }}">
+ <meta name="twitter:card" content="{{ .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 f94e50a..2dfa1d4 100644
--- a/layouts/partials/sidebar/left.html
+++ b/layouts/partials/sidebar/left.html
@@ -7,7 +7,7 @@
<header>
{{ with .Site.Params.sidebar.avatar }}
- {{ if (default true .enabled) }}
+ {{ if .enabled }}
<figure class="site-avatar">
<a href="{{ .Site.BaseURL | relLangURL }}">
{{ if not .local }}
@@ -89,7 +89,7 @@
</li>
{{ end }}
- {{ if (default false .Site.Params.colorScheme.toggle) }}
+ {{ if .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 1f2abc5..e42da27 100644
--- a/layouts/partials/widget/archives.html
+++ b/layouts/partials/widget/archives.html
@@ -10,9 +10,7 @@
<h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2>
{{ $pages := where $context.Site.RegularPages "Type" "in" $context.Site.Params.mainSections }}
- {{ $notHidden := where $context.Site.RegularPages "Params.hidden" "!=" true }}
- {{ $filtered := ($pages | intersect $notHidden) }}
- {{ $archives := $filtered.GroupByDate "2006" }}
+ {{ $archives := $pages.GroupByDate "2006" }}
<div class="widget-archive--list">
{{ range $index, $item := first (add $limit 1) ($archives) }}