aboutsummaryrefslogtreecommitdiff
path: root/_includes/gallery
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@gmail.com>2019-10-27 09:57:37 -0400
committerAndrew Lee <alee14498@gmail.com>2019-10-27 09:57:37 -0400
commite62e7bb6b14555c9bbe5d40d217103984f4f80e6 (patch)
tree21887d847dccacb47644eb6f74ce31326172303c /_includes/gallery
parent716ea6ed2b64c921a799d872a07bfbd53b2a3e58 (diff)
downloadpokeworld-website-e62e7bb6b14555c9bbe5d40d217103984f4f80e6.tar.gz
pokeworld-website-e62e7bb6b14555c9bbe5d40d217103984f4f80e6.tar.bz2
pokeworld-website-e62e7bb6b14555c9bbe5d40d217103984f4f80e6.zip
Rewrite progress
Diffstat (limited to '_includes/gallery')
-rw-r--r--_includes/gallery51
1 files changed, 51 insertions, 0 deletions
diff --git a/_includes/gallery b/_includes/gallery
new file mode 100644
index 0000000..97022aa
--- /dev/null
+++ b/_includes/gallery
@@ -0,0 +1,51 @@
+{% if include.id %}
+ {% assign gallery = page[include.id] %}
+{% else %}
+ {% assign gallery = page.gallery %}
+{% endif %}
+
+{% if include.layout %}
+ {% assign gallery_layout = include.layout %}
+{% else %}
+ {% if gallery.size == 2 %}
+ {% assign gallery_layout = 'half' %}
+ {% elsif gallery.size >= 3 %}
+ {% assign gallery_layout = 'third' %}
+ {% else %}
+ {% assign gallery_layout = '' %}
+ {% endif %}
+{% endif %}
+
+<figure class="{{ gallery_layout }} {{ include.class }}">
+ {% for img in gallery %}
+ {% if img.url %}
+ <a href=
+ {% if img.url contains "://" %}
+ "{{ img.url }}"
+ {% else %}
+ "{{ img.url | relative_url }}"
+ {% endif %}
+ {% if img.title %}title="{{ img.title }}"{% endif %}
+ >
+ <img src=
+ {% if img.image_path contains "://" %}
+ "{{ img.image_path }}"
+ {% else %}
+ "{{ img.image_path | relative_url }}"
+ {% endif %}
+ alt="{% if img.alt %}{{ img.alt }}{% endif %}">
+ </a>
+ {% else %}
+ <img src=
+ {% if img.image_path contains "://" %}
+ "{{ img.image_path }}"
+ {% else %}
+ "{{ img.image_path | relative_url }}"
+ {% endif %}
+ alt="{% if img.alt %}{{ img.alt }}{% endif %}">
+ {% endif %}
+ {% endfor %}
+ {% if include.caption %}
+ <figcaption>{{ include.caption | markdownify | remove: "<p>" | remove: "</p>" }}</figcaption>
+ {% endif %}
+</figure> \ No newline at end of file