Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photo Plugin seems to support inline galleries now #906

Open
Ockenfuss opened this issue May 2, 2023 · 0 comments
Open

Photo Plugin seems to support inline galleries now #906

Ockenfuss opened this issue May 2, 2023 · 0 comments

Comments

@Ockenfuss
Copy link

In the elegant documentation, it says photo galleries can only be added at the end of the article and that there is need for further development (link).

It seems like in the meanwhile, the photos plugin supports inline galleries. According to the documentation, there must be a file "inline_gallery.html" available, which provides a template for a gallery. Subsequently, the user can just write gallery::{photo}example_gallery to create an inline gallery (see the examples of the photos plugin)

When I had a first try, it seemed quite easy to implement this in elegant: Just move the following lines of code from article.html to its own template file inline_gallery.html. Be aware that there are some small modifications.

Article.html, to be deleted:

            {% if article.photo_gallery %}
            <div class="gallery">
                {% for title, gallery in article.photo_gallery %}
                <h1>{{ title }}</h1>
                {% for name, photo, thumb, exif, caption in gallery %}
                <a href="{{ SITEURL }}/{{ photo }}" title="{{ name }}" exif="{{ exif }}" caption="{{ caption }}"><img
                        src="{{ SITEURL }}/{{ thumb }}"></a>
                {% endfor %}
                {% endfor %}
            </div>
            {% endif %}

New file Inline_gallery.html:

<div class="gallery">
    {% for title, gallery in galleries %}
        <h1>{{ title }}</h1>
        {% for name, photo, thumb, exif, caption in gallery %}
            <a href="{{ SITEURL }}/{{ photo }}" title="{{ name }}" exif="{{ exif }}" caption="{{ caption }}"><img src="{{ SITEURL }}/{{ thumb }}"></a>
        {% endfor %}
    {% endfor %}
</div>

Additionally, you might need the following in you pelicanconf.py:

PHOTO_LIBRARY="path/to/galleries"
PHOTO_INLINE_GALLERY_ENABLED=True
PLUGINS= ['photos']

Would it make sense to adapt the elegant theme in a similar way? What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant