nicokaiser / hugo-theme-gallery

Gallery Theme for Hugo
https://nicokaiser.github.io/hugo-theme-gallery/
MIT License
352 stars 102 forks source link

Support gallery alongside albums on list.html #12

Closed nicokaiser closed 1 year ago

nicokaiser commented 1 year ago

In some cases it might be desirable to show a list of albums and a list of photos (gallery) on one page.

contents
`-- animals
    |-- _index.md
    |-- cats
    |   |-- img_0101.jpg
    |   |-- img_0102.jpg
    |   `-- index.md
    |-- img_0001.jpg
    |-- img_0002.jpg
    `-- img_0003.jpg

=> Extract page_album.html from single.html to be able to include it into a custom list.html:

  {{ define "main" }}
    {{- partial "page_header.html" . -}}
    {{- partial "page_albums.html" . -}}
+   {{- partial "page_gallery.html" . -}}
  {{ end }}

Since now all images are displayed, images that should only be used as album thumbnail (featured image) need to be moved to a sub-folder:

contents
`-- animals
    |-- _index.md
    |-- cats
    |   |-- img_0101.jpg
    |   |-- img_0102.jpg
    |   `-- index.md
    |-- images
    |   `-- thumbnail.jpg
    |-- img_0001.jpg
    |-- img_0002.jpg
    `-- img_0003.jpg

In this example, images/thumbnail.jpg is only used as thumbnail for the "animals" album and not displayed in tits photos (need to add featured_image: images/thumbnail.jpg in the frontmatter of _index.md)

Note: if we remove img_000*.jpg from "animals" the album will now be hidden, since it has no images.

nicokaiser commented 1 year ago

439ae57c68c1e6bb226c2748021f4361df62f10f (develop branch) reflects this change.