Another gallery question

Hi there,
it’s me, the Grav newbie. Basicly I have some success converting my WP page to Grav. But now I need galleries! So I read the cookbook from the Grav documentation which sounds easy enough even for me.
But it is not easy! What I did was:

  • creating a page
  • put some images into the pages folder
  • wrote image.meta.yaml files
  • created the gallery.html.twig file into the templates folder

But that cannot be all! I cannot see a gallery or any image on my page. So my questions:

  • what kind of page do I need for the gallery? Default, modular, item? I don’t know.
  • what must I write into the file in my page directory? Or will the written and filled when I call the page?
  • how do I call the gallery function in my page?

As you can see, the cookbook was not good enough for me and my little Grav knwoledge.
I know that there is missing basic knowledge from my side, however I am willing to learn.


@berni51, In a fresh Grav installation using Quark as theme, the Gallery example from the Cookbook works fine with me…

Keep in mind, the name of a page refers to the name of the template to be used. See Theme Basics. For example:

  • uses template user/theme/quark/templates/default.html.twig
  • uses template user/theme/quark/templates/blog.html.twig
  • uses template user/theme/quark/templates/gallery.html.twig

In a fresh Grav installation, after following the cookbook example, the folder structure should look similar to:

├── 01.home
│   └──
├── 02.typography
│   └──
    ├──     <-- the name 'gallery' is important            <----+
    └── unsplash-overcast-mountains.jpg                                    |
user/themes/quark/templates                                                |
├── blog.html.twig                                                         |
├── default.html.twig                                                      |
├── error.html.twig                                                        |
├── gallery.html.twig  <-- template used by pages named ''  <----+
├── item.html.twig
└── ...

The content of will be displayed above the gallery. Using an empty you will see something similar to:


Of course, it looks ugly, because Quark has no styling for your new gallery. You will have to provide it yourself.

Instead of building your own gallery, you could also use a plugin that provides a gallery:

Also, be advised to use an inherited theme. If not, your changes may be undone when a new version of Quark is released.

@berni51 - I came the same way as you, from WP to Grav :smile:.
I’m using unitegallery for all my foto gallerys (you can find most of them in the blog).
unitegallery is very easy to use, just put all the fotos in the same directory as the article and you’re done.
Unitegallery also has some built-in templates, such as masonry (thats what I’m using).
if you like, I can send you my gallery page template or post it here.
and yes, you should use theme inheritance, as @pamtbaau suggested.

@pamtbaau and @hoernerfranz: thanks a lot for your kind assistance so far and for your endurance with a newbie.
After reading your posts I understand a little bit more and got the gallery running. However this gallery was not what I need and I now agree to your proposuals and will use UniteGallery.

Further I read the docs about inheritance and the first I will do today is to modify my site to an inherited theme. Next is to become familiar with UniteGallery and then I may hopefully be able to finish my conversion from WP.

Yesterday I have spent 2 hours on the hoernerfranz website, which was also very helpful (and funny too).
Thx again for this two answers which in fact were a short explanation about Grav basics.


@berni51b- you’re welcome, have fun with Grav !
once you get used to it and discover all the possibilities, I’m sure you’ll never look back…