diff options
Diffstat (limited to 'layouts/partials/article/components')
-rw-r--r-- | layouts/partials/article/components/header.html | 2 | ||||
-rw-r--r-- | layouts/partials/article/components/photoswipe.html | 88 | ||||
-rw-r--r-- | layouts/partials/article/components/related-content.html | 2 |
3 files changed, 70 insertions, 22 deletions
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> |