Photoswipe Sample

 Posted March 20, 2017 (Updated January 2, 2023)  |  2 minutes  |  372 words  |  Some Person
Photoswipe Sample https://caleb-vincent.gitlab.io/lessbeautifulhugo/post/2017-03-20-photoswipe-gallery-sample/

Beautiful Hugo adds a few custom shortcodes use with PhotoSwipe.

Example 1

Fort ticonderoga 3c
Fort Ticonderoga Bicentenial Stamp

US Postage Stamp, 1955 Issue, 3c depicting Fort Ticonderoga.
Source: Wikimedia Commons

{{< figure thumb="_small" link="Fort_Ticonderoga-3c.jpg" title="Fort Ticonderoga Bicentenial Stamp" caption="US Postage Stamp, 1955 Issue, 3c depicting Fort Ticonderoga." attrlink="https://commons.wikimedia.org/wiki/File:Fort_Ticonderoga-3c.jpg#Licensing" attr="Wikimedia Commons" >}}

Example 2

The above was created using the following shortcodes:

{{< gallery >}}
  {{< figure thumb="-thumb" link="/img/hexagon.jpg" >}}
  {{< figure thumb="-thumb" link="/img/sphere.jpg" caption="Sphere" >}}
  {{< figure thumb="-thumb" link="/img/triangle.jpg" caption="Triangle" alt="This is a long comment about a triangle" >}}
{{< /gallery >}}

Example 3

The above was created using the following shortcode:

{{< caption-position="center" caption-effect="fade" hover-effect="grow" gallery filter="album/*" >}}

Usage

To enable Photoswipe, set either the individual page’s Frontmatter with photoswipe: true or set photoswipe = true in config.toml. Both figure and gallery will work without Photoswipe (or any javascript for that matter), but instead of a lightbox the thumbnail will link directly to the image.

Figure

The Gallery is based on Hugo Easy Gallery by Li-Wen Yip.