Created
March 15, 2015 14:50
-
-
Save BostonEnginerd/311980c0bbd62bb46fbc to your computer and use it in GitHub Desktop.
Adding a gallery to Pelican
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Include the gallery and thumbnailer plugins. | |
Add the following to pelicanconf.py | |
THUMBNAIL_SIZES={'thumbnail_square': '100'} | |
At the bottom of the article template, add the following near the bottom of the content block: | |
{% if article.gallery %} | |
<section> | |
<div id="blueimp-gallery" class="blueimp-gallery"> | |
<div class="slides"></div> | |
<h3 class="title"></h3> | |
<a class="prev">‹</a> | |
<a class="next">›</a> | |
<a class="close">×</a> | |
<a class="play-pause"></a> | |
<ol class="indicator"></ol> | |
</div> | |
<h3> Image Gallery</h3> | |
<div id="links"> | |
{{ article.gallery_content }} | |
</div> | |
</section> | |
{% endif %} | |
In the script block, add: | |
{% if article.gallery %} | |
<script src="/theme/js/blueimp-gallery.min.js"></script> | |
<script> | |
document.getElementById('links').onclick = function (event) { | |
event = event || window.event; | |
var target = event.target || event.srcElement, | |
link = target.src ? target.parentNode : target, | |
options = {index: link, event: event}, | |
links = this.getElementsByTagName('a'); | |
blueimp.Gallery(links, options); | |
}; | |
</script> | |
{% endif %} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment