Hi everyone, I want to know how is it possible to create a gallery page (I have some of those) and automatticly make links to be shown on a page where the user can choose which gallery to visit.
### [Cambio de Madrinas 2014](/festejos/galeria/2014/cambio%20de%20madrinas%202014)
### [Comunidad Española en Querétaro celebrando a la Virgen de la Covadonga](/festejos/galeria/2014/comunidad%20española%20de%20querétaro)
### [Halloween 2014](/festejos/galeria/2014/halloween%202014)
### [Halloween infantil 2014](/festejos/galeria/2014/halloween%20infantil%202014)
### [Posada en Puebla 2014](/festejos/galeria/2014/posada%20en%20puebla%202014)
### [Posadita 2014](/festejos/galeria/2014/posadita%202014)
### [Presentación de nuestra Nueva Madrina 2014 / 2015 Sofía González Hermida](/festejos/galeria/2014/presentación%20de%20nuestra%20nueva%20madrina%202014)
This is the markdown I use in the gallery selection page and want to make hrefs to any new gallery. I’m sorry if my english is bad and my explanation is not clear. (I speak spanish)
@mera.inventio, If I understand correctly, you want a page that automatically generates a list of available galleries in you site.
If so, a possible solution could be to add taxonomy tags to your gallery pages and create a collection based on these tagged pages. Then loop through the collection and create a list of anchors.
When you create a new gallery page or update an existing, the generated list will automatically be updated.
The following outlines the steps needed:
- Create an inherited theme based on theme ‘Photographer’ you are using. See Theme Inheritance steps 1-5
- Add a taxonomy to the pages that contain a gallery, like:
---
title: Cambio de Madrinas 2014
taxonomy:
category: gallery
---
For docs on collections see https://learn.getgrav.org/16/content/collections
- Create a page ‘galleries.md’ that will contain links to all galleries. Add a collection definition to its header:
---
title: Listado de galerías
content:
items:
'@taxonomy.category': gallery
---
For docs on creating a collection on taxonomies see https://learn.getgrav.org/16/content/collections#taxonomy-collections
- Create a new template in your inherited theme named ‘/themes/mytheme/templates/galleries.html.twig’ and loop through the collection of galleries to create a list of anchors. E.g.:
{% extends 'partials/base.html.twig' %}
{% block content %}
{% for gallery in page.collection() %}
<a href="{{ gallery.url }}"><h3>{{ gallery.title }}</h3></a>
{% endfor %
{% endblock %}
Of course, you will need to add some extra html elements to create a suitable layout.
Hope this gives you an idea to play with…
Thank u so much @pamtbaau , this is exactly what I want.
Easy to follow your directions.
have a nice day.