Gallery Page

There are two modes to the gallery. You can specify it in the front matter.

content/gallery/anygalleryname/index.md

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21

---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
description: my gallery
type: gallery
mode: one-by-one # at-once or one-by-one
tags:
-
series:
-
categories:
-
images: # when mode is one-by-one, images front-matter variable works
  - image: image1.jpg
    caption: caption1
  - image: image2.jpg
    caption: caption2
    ...
---

one-by-one

If you set the mode to one-by-one, you have to set the images front matter. This mode is used to specify captions, order of images.

1
2
3
4
5
6
7
8
---
...
images: # when mode is one-by-one, images front-matter variable works
  - image: image1.jpg
    caption: caption1
  - image: image2.jpg
    caption: caption2
    ...

at-once

If you set the mode to at-once, you don’t need to set the images front-matter. Just put all your images to the static/gallery/anygalleryname folder.

  1. Make a gallery folder under the content folder

    root
    β”œβ”€β”€ content
    β”‚Β Β  β”œβ”€β”€ gallery
    
  2. Make a sub folder under the gallery folder

    root
    β”œβ”€β”€ content
    β”‚Β Β  β”œβ”€β”€ gallery
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ anygalleryname
    
  3. Make a index.md file under the sub folder using this command

    hugo new --kind gallery gallery/anygalleryname/index.md
    
  4. Put your images in static folder

    root
    β”œβ”€β”€ static
    β”‚Β Β  β”œβ”€β”€ gallery
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ anygalleryname
    β”‚Β Β  β”‚Β Β  β”‚   β”œβ”€β”€ ...your images here