Skip to content

Latest commit

 

History

History
135 lines (110 loc) · 5.09 KB

gallery.md

File metadata and controls

135 lines (110 loc) · 5.09 KB
layout title searchable versions
widget
Gallery
true
version url
Version 2.0
/widgets/v2/gallery/
version url
Version 1.0
/widgets/v1/gallery/

Gallery widget

The gallery widget allows the user to display a selection or group of images that have been uploaded to the Images section of the Editor. By default the gallery comes with no images, the user must select them when they select the widget. If you are using the image gallery as part of your template you can state the images that are shown.

Exmaples

Basic usage

{% highlight python %} {% raw %}

{{widget('gallery', 'imagegallery', {})|raw}}

{% endraw %} {% endhighlight %}

The above example will display an area in the template where the user can select and then add images to, it will not show any images by default.

Example usage

{% highlight python %} {% raw %}

{{widget('gallery', 'imagegallery', { 'showTitle': true, 'showDescription': true, 'images':[ { 'url':'http://placehold.it/350x300', 'title':'First image title', 'description': 'First image description' }, { 'url':'http://placehold.it/350x400', 'title':'Second image title', 'description': 'Second image description' }, { 'url':'http://placehold.it/650x300', 'title':'Third image title', 'description': 'Third image description' } ] })|raw}}

{% endraw %} {% endhighlight %}

Resulting HTML:

{% highlight html %} {% raw %}

{% endraw %} {% endhighlight %}

Widget options

The following options are available for the gallery widget:

  • showtitle: Will show or hide the title, true for showing and false for hiding the image title. This can be overwritten by the user.

  • showDescription: Will show or hide the description, true for showing and false for hiding the image description. This can be overwritten by the user.

  • images: The default images for the gallery, see Setting images for more details.

Setting images

{% highlight python %} {% raw %} ... { 'imageWidth': '350', 'imageHeight': '300', 'url':'http://placehold.it/350x300', 'title':'First image title', 'description': 'First image description' } ... {% endraw %} {% endhighlight %}

To see the above example in context please refer to the Example usage. The images will be shown as default in the template, but they won't be shown in the images panel of the Editor. If the user replaces the images they will no longer be accessible, you will need to state them in the metadata file in order for them to appear in the images panel. The url can be either an internal or external image path, all other image settings are optional.