Skip to content

Commit 13e6f45

Browse files
Merge pull request #52 from victoriadotdev/update-gallery
Update gallery template (fix #46, close #35)
2 parents f11239f + e284c3d commit 13e6f45

File tree

46 files changed

+326
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+326
-88
lines changed

README.md

Lines changed: 30 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<h1><a href="https://hugo-sam.netlify.com/" target="_blank" rel="noopener">Call me Sam: a theme for Hugo</a></h1>
22

3+
[![Netlify Status](https://api.netlify.com/api/v1/badges/b069f23f-06c5-4af6-b1aa-6304d986f9b0/deploy-status)](https://app.netlify.com/sites/hugo-sam/deploys)
34
[![Build Status](https://travis-ci.com/victoriadotdev/hugo-theme-sam.svg?branch=master)](https://travis-ci.com/victoriadotdev/hugo-theme-sam)
45
![Latest Release](https://img.shields.io/github/tag/victoriadotdev/hugo-theme-sam.svg)
56

@@ -15,7 +16,7 @@ Focused on content and typography, the stylized index page is really just a list
1516

1617
- Showcase content
1718
- Content-focused page templates for list pages, single pages, and posts
18-
- A responsive CSS grid gallery page that renders from a folder of images
19+
- A responsive CSS grid gallery page that renders from images in your [Page Bundle](https://gohugo.io/content-management/organization/#page-bundles)
1920
- Customize
2021
- Custom navigation menu set via `config.toml`
2122
- Custom footer text
@@ -91,65 +92,56 @@ $ hugo new posts/your-post-title.md
9192

9293
## Image gallery
9394

94-
To create an image gallery, place all the files you want included in a folder called "images" (you can change the name of the "images" folder in `config.toml` if you wish). Place your "images" folder in a subfolder of `content/` with any name. The directory structure then looks like this:
95+
To create an image gallery, place all the files you want included in your [Page Bundle](https://gohugo.io/content-management/organization/#page-bundles). The directory structure might then look like this:
9596

9697
```
9798
content/
9899
└── gallery/
99-
└── images/
100-
| ├── file_1.jpg
101-
| ├── file_2.jpg
102-
| ── file_3.jpg
103-
└── _index.md
100+
└── _index.md
101+
── images/
102+
├── file_1.jpg
103+
── file_2.jpg
104+
└── file_3.jpg
104105
```
105106

106-
To automagically generate a gallery from the images, set `type: "gallery"` in the front-matter of `_index.md`. The gallery title is defined in the front-matter as well. You can also optionally define the page URL using `url`. Here is an example of a gallery's `_index.md`:
107+
To automagically generate a gallery from the images, set `type: "gallery"` in the front-matter of `_index.md`. You can also set other options for the gallery:
107108

108-
```
109+
* The gallery `title`
110+
* The page link with `url`
111+
* The `maxWidth` of the resized images
112+
* Whether you want the images to link to the full size files, with `clickablePhotos`
113+
114+
Here is an example of a gallery's `_index.md`:
115+
116+
```yaml
109117
---
110118
title: "Portraits"
111119
type: "gallery"
112120
url: "/portrait-gallery"
121+
maxWidth: "800x"
122+
clickablePhotos: true
113123
---
114124
```
115125

116-
In order to create more than one gallery, create multiple subfolders in `content/` with this file structure and `type: "gallery"` defined in the `_index.md` front matter. For example:
117-
126+
In order to create more than one gallery, create multiple Page Bundles with images and `type: "gallery"` defined in the `_index.md` front matter. For example:
118127

119128
```
120129
content/
121130
| └── gallery/
122-
| └── images/
123-
| | ├── file_1.jpg
124-
| | ├── file_2.jpg
125-
| | ── file_3.jpg
126-
| └── _index.md
131+
| └── _index.md
132+
| ── images/
133+
| ├── file_1.jpg
134+
| ── file_2.jpg
135+
| └── file_3.jpg
127136
|
128137
└── portfolio/
129-
└── images/
130-
| ├── file_1.jpg
131-
| ├── file_2.jpg
132-
| ── file_3.jpg
133-
└── _index.md
138+
└── _index.md
139+
── images/
140+
├── file_1.jpg
141+
── file_2.jpg
142+
└── file_3.jpg
134143
```
135144

136-
In `config.toml`, you can set `smallPreviewImages` to `true` in order to use small sized thumbnails. Include those thumbnail files in your gallery image folder. In exampleSite, this looks like:
137-
138-
```
139-
content/
140-
└── gallery/
141-
└── images/
142-
│ └── small/
143-
| ├── file_1.jpg
144-
| ├── file_2.jpg
145-
| └── file_3.jpg
146-
├── file_1.jpg
147-
├── file_2.jpg
148-
└── file_3.jpg
149-
```
150-
151-
The thumbnails need to have the same filenames as the larger images they represent.
152-
153145
That's it! Sam's gallery layout template will automagically build the page from your images.
154146

155147

exampleSite/config.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ pygmentsCodefences = true
1313
dateformfull = "Mon Jan 2 2006 15:04:05 EST"
1414
favicon = "sam.ico"
1515
homepage = "main" # What to call the home page link
16-
galleryFolder = "images/" # Where you've put your images, after "/content/gallery/"
17-
clickablePhotos = false # Allow links to the full size images
18-
smallPreviewImages = true # Show small images from the subfolder instead of the big versions in the gallery
19-
# Note: This will only become active if clickablePhotos is also true.
20-
smallImagesSubfolder = "small/" # The subfolder for the small versions of the images under the gallery (with trailing slash)
21-
# For each image the small version has to have the same filename as the big version.
2216
footerText = "Call me Sam, a theme for Hugo."
2317

2418
# Metadata for Open Graph and Twitter
@@ -41,3 +35,6 @@ pygmentsCodefences = true
4135
[[params.mainMenu]]
4236
link = "/about"
4337
text = "who is sam?"
38+
39+
[imaging]
40+
quality = 75

0 commit comments

Comments
 (0)