Gallery Layout Document

Gallery layout is useful for demonstrating pictures and its statistical data.

This layout can be used on both section page and regular post.

Configuration

---
type: 'gallery'
---

Specify type in front-matter will change the template lookup order.

Content resources. URL can be an absolute path (with / prefix, relative to base URL), or relative path (without /, relative to current path)

Hugo will handle multilingual scenario out of the box

For example:

https://kaiiiz.github.io/hugo-theme-monochrome/about
        \____________________________________/\____/
                    base URL           gallery_resources
---
gallery_resources: '/about'
---

default: error will occur in page

Resouces Configuration

These settings are under the resource specified in gallery_resources.

title

Title of image.

---
title: 'Gallery'
---

default: no title

Link of the title.

---
gallery_title_link: 'https://github.com/kaiiiz'
---

default: no title link

Image URL relative to the base URL. (with or without / prefix)

For example:

https://kaiiiz.github.io/hugo-theme-monochrome/thanks.jpg
        \_____________________________________/\________/
                    base URL                gallery_img_src
---
gallery_img_src: 'thanks.jpg'
---

default: no image

Link of the image.

---
gallery_img_link: 'https://github.com/kaiiiz'
---

default: no image link

Caption of the image. HTML is available.

---
gallery_img_caption: '<span>Photo by <a href="https://unsplash.com/@swimstaralex?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Alexander Sinn</a> on <a href="https://unsplash.com/s/photos/thanks?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>'
---

default: no figure caption under image

Statistic of the image. The format is:

---
- key: key1
  value: value1
- key: key2
  value: value2
---

key and value both support markdown syntax.

default: no figure caption under image

weight

---
weight: 3
---

default: default order

Headless Bundle

Hugo supports an amazing feature called Headless Bundle, which elegantly resolved the resouces publish issue.

For example, if you don’t want to publish the resouces of the gallery layout, you can create a leaf bundle and specified headless = true in index.md’s front-matter. These resources will only be used during rendering process. In other word, no file will be generated to /public folder.

Checkout Headless Bundle for more details.