nicokaiser / hugo-theme-gallery

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

Adding gallery to homepage #69

Closed hjklpt1 closed 2 months ago

hjklpt1 commented 2 months ago

Is it possible to add whole gallery grid images to the homepage? I do not want to create albums. Thanks in advance for your suggestions.

nicokaiser commented 2 months ago

Did you try to just create an _index.md file? Of course there cannot be sub-albums then, but that might work…

hjklpt1 commented 2 months ago

I have a folder in \content\paintings and I have the \content_index.md file. However it does not add the photos under the paintings to the home page like a single page gallery (masonry grid style like in the cats example page).

I tried to edit home.html layout with {{ partial "gallery.html" . }} I don't want to intervene with the original layouts but it is the only solution I could find.

nicokaiser commented 2 months ago

Oh you are right. You might need to add a local version of home.html which looks like single.html. Then you can use content/index.md and your images go to content/*.jpg.

nicokaiser commented 2 months ago

Ok, so here is how it's done:

{{ define "main" }}
  {{ partial "title.html" . }}
  {{ partial "gallery.html" . }}
  {{ partial "related.html" . }}
{{ end }}
---
description: Here is your subtitle
title: My Gallery
featured_image: martin-martz-wRuhOOaG-Z4-unsplash.jpg # default: first image in this directory
menus:
  main:
    name: Home
    weight: -1
---