layout | title | permalink | gallery-key |
---|---|---|---|
gallery |
A Gallery! |
/a-gallery/ |
my-holiday-photos |
Created
January 13, 2018 12:04
-
-
Save joshdavenport/cfb2df657f0357fa8d44a0fbc92431be to your computer and use it in GitHub Desktop.
Basic reusable jekyll gallery utilising variable
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
--- | |
layout: default | |
--- | |
# placed in /_layouts/ | |
{% capture gallery_path %}assets/gallery/{{ page.gallery-key }}{% endcapture %} | |
{% for image in site.static_files %} | |
{% if image.path contains gallery_path %} | |
<img src="{{ site.baseurl }}{{ image.path }}" alt="image" /> | |
{% endif %} | |
{% endfor %} |
Been a very long time since I've used this or even jekyll but that should basically be it yeah @xihajun
Add the layout in _layouts, then use the layout in front matter as shown in the a-gallery.md
example (look at the raw markdown, the gist viewing is formatting the md in a way that is useless for jekyll markdown based pages)
thank you 😊 @joshdavenport
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
May I kindly ask how does it work?
Just put those two file into
/_layouts/gallery.html
and a readme file?