jekyll-gallery-generator icon indicating copy to clipboard operation
jekyll-gallery-generator copied to clipboard

List galleries on index page

Open chris-gooley opened this issue 6 years ago • 1 comments

I'm a bit new to jekyll and I'm wondering if there is a way to list the galleries on the root index page of the site instead of on a subpage.

My galleries are located in a subfolder called photos which I have specified in the config file. I have tried to reuse the gallery listing loop from gallery_index.html in the index.html file however it doesn't render anything eg

{% for gallery in page.galleries %}

Here is my config file:

gallery:
  dir: 'photos'                   # Path to the gallery
  symlink: false            # false: copy images into _site. true: create symbolic links (saves disk space)
  title: "Photos"           # Title for gallery index page
  title_prefix: "Photos: "  # Title prefix for gallery pages. Gallery title = title_prefix + gallery_name
  sort_field: "date_time"   # How to sort galleries on the index page.
                            # Possible values are: title, date_time, best_image
  thumbnail_size:
    x: 700                  # max width of thumbnails (in pixels)
    y: 450                  # max height of thumbnails (in pixels)
  # The following options are for individual galleries.
  galleries:
    europe:
      best_image: CKG_5420_processed.jpg  # The image to show on the gallery index page. Defaults to the last image.
      name: 'Europe, Dec 2017'
      description: 'Our trip to Europe, December 2017 - January 2018'
    deek_creek_hike:
      best_image: CKG_3308_processed.jpg
      name: 'Deep Creek Hike, August 2017'
      description: 'A hike down to Deep Creek over a couple of nights.'
    with_info:
      info:
        desc: "Gallery Description" # Info fields can be used in custom templates.

chris-gooley avatar Jun 13 '18 10:06 chris-gooley

You have to do 2 for loops for this one.

Do something like:

{% for p in site.pages %}
      {% for gallery in p.galleries %}
       etc...............
      {% endfor %}
{% endfor %}

everonegraham avatar Dec 25 '18 21:12 everonegraham