Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List galleries on index page #41

Open
chris-gooley opened this issue Jun 13, 2018 · 1 comment
Open

List galleries on index page #41

chris-gooley opened this issue Jun 13, 2018 · 1 comment

Comments

@chris-gooley
Copy link

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.
@everonegraham
Copy link

everonegraham commented Dec 25, 2018

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 %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants