3

How can I add multiple images on a page?

I want to have pages with 3-4 paragraphs and under the paragraphs I want to have multiple images like a small photo gallery, I found a extension for the images in bolt lib but it is more photographic oriented and I wander if it is possible to do it simpler then using the plugin... the curiosity is if boltcms can do this with default build.

Starlays
  • 1,039
  • 2
  • 15
  • 29

2 Answers2

6

In your contenttypes.yml setup file, add an imagelist to your fields, something like this:

    gallery:
        type: imagelist
        label: "Gallery Images"

Then in your frontend template you print them out in the style that your gallery plugin needs, here's one that uses magnific as an example:

{% for image in record.gallery %}
    <a href="{{ thumbnail(image, 1000, 1000) }}">
        <i class="fi-arrows-expand hide"></i>
        <img src="{{thumbnail(image,150,100)}}"> 
    </a>   
{% endfor %} 
Ross Riley
  • 826
  • 5
  • 8
0

If you want to use the lightbox plugin that is included in the default Bolt theme, @Ross' for loop can be a little simpler:

{% for img in record.gallery %}
    {{ popup(img, 150, 100) }}
{% endfor %}
Sphinxxx
  • 12,484
  • 4
  • 54
  • 84