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 gallery.md file in my page directory? Or will the gallery.md 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.

Regards
Berni

@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:

  • default.md uses template user/theme/quark/templates/default.html.twig
  • blog.md uses template user/theme/quark/templates/blog.html.twig
  • gallery.md 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:

user/pages
├── 01.home
│   └── default.md
├── 02.typography
│   └── default.md
└── 03.gallery
    ├── gallery.md     <-- 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 'gallery.md'  <----+
├── item.html.twig
└── ...

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

image

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 @anon76427325 suggested.

@anon76427325 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.

regards
Berni

@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…