victoriadrake / hugo-theme-sam

A Simple and Minimalist theme for Hugo with a focus on typography and content.
https://victoria.dev/hugo-theme-sam/
Apache License 2.0
421 stars 176 forks source link

Multiple galleries #26

Closed matthewolckers closed 6 years ago

matthewolckers commented 6 years ago

Firstly, thank you for creating a great theme! I really like the design.

In my site, I would like to create multiple image galleries with different names. For example, a car gallery with photos of cars and a bicycle gallery with photos of bicycles. My current approach is to copy themes/sam/layouts/gallery/list.html to layouts/cars/list.html and then replace {{ $path := "gallery/" }} with {{ $path := "cars/" }}. The problem is that I will have more 50 galleries so creating a list.html for every gallery is tedious. Is there some alternative syntax that is more general so I can just use a single list.html for all my galleries?

Disclaimer: I am new to Hugo.

mfg92 commented 6 years ago

You can use my shortcode gallery. Then you would only need a normal .md files (like cars.md) for every gallery and can use the provided shortcode there to include your pictures.

victoriadrake commented 6 years ago

@mfg92 Neat solution!

@matthewolckers I'd go with this shortcode approach. I don't know of another method that would save you the same amount of typing.