grav-plugin-unitegallery icon indicating copy to clipboard operation
grav-plugin-unitegallery copied to clipboard

Shortcode to use in markdown?

Open cpamcom opened this issue 8 years ago • 2 comments

Hi I don't understand how to include a gallery in my modular. Does a shortcode exist?

cpamcom avatar Mar 24 '17 09:03 cpamcom

Hi, To create a gallery you should call unite_gallery function from some twig-template and use this template for your gallery page. I've added more examples to Readme.md. See if it helps.

I'll think about adding some markdown shortcode to simplify the process.

variar avatar Mar 24 '17 14:03 variar

Hi, I think I have a solution for this. Maybe you want to integrate this in the manual of the project.

Generate a file gallery_embedded.html.twig in your template templates/partials directory with the following content:

{% set myimages = null %}

{% set break = false %}
{% for p in page.children if not break %}
    {% if p.header.gallery_id == gal_id %}
      {% set myimages = p.media.images %}
      {% set break = true %}
    {% endif %}
{% endfor %}

<div class="gallery-container">
 {{ unite_gallery(myimages, '{"gallery_theme":"'~ page.header.unitegallery.gallery_theme ~'", "tiles_type":"'~ page.header.unitegallery.tiles_type ~'", "lightbox_show_textpanel": '~ page.header.unitegallery.lightbox_show_textpanel ~', "lightbox_textpanel_enable_description": '~ page.header.unitegallery.lightbox_textpanel_enable_description ~', "tile_enable_textpanel":'~ page.header.unitegallery.assets_in_meta ~', "grav_gallery_div_id":'~ gal_id ~'}') }}
</div>

Create subdirectories in your page like gallery1 and gallery2. Create in every subdirectory a file default.md with the following content:

default.md in /gallery1

---
gallery_id: 1
---

default.md in /gallery2

---
gallery_id: 2
---

When this is done enhance the header of your md-file and call the gallery in the content area like shown here:

---
title: Test
menu: Test123
unitegallery:
    gallery_theme: tiles   # tiles slider carousel compact default grid tilesgrid
    tiles_type: justified  # justified nested columns
    lightbox_show_textpanel: 'true' # value always in '...'
    lightbox_textpanel_enable_description: 'true' # value always in '...'
    tile_enable_textpanel: 'true' # value always in '...'
    assets_in_meta: true   # discable caching
---
My content here.

My first gallery

{% include 'partials/gallery_embedded.html.twig' with {'gal_id': 1} %}

My second gallery

{% include 'partials/gallery_embedded.html.twig' with {'gal_id': 2} %}

uwekoenig avatar Jan 06 '19 17:01 uwekoenig