aboutsummaryrefslogtreecommitdiffstats
path: root/_includes
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2021-05-27 00:13:05 +0300
committerla-ninpre <leobrekalini@gmail.com>2021-05-27 00:19:10 +0300
commit324991d82ef26798ed5842a6fe03eabc798ff497 (patch)
tree8097dad5a93e283e42e7b4a1e0491d389b912c76 /_includes
parent3e30c7241cb18c5e02195e889b9e4dc73490214a (diff)
downloadaaoth.xyz-324991d82ef26798ed5842a6fe03eabc798ff497.tar.gz
aaoth.xyz-324991d82ef26798ed5842a6fe03eabc798ff497.zip
modify art page to display thumbnails
thumbnails are currently created using shell script and require imagemagick installed on the server. i know it's stupid, but i think that including thumbnails to repo is also stupid. maybe later i replace this script with actual jekyll plugin, but for this i'll need to familiarize myself with ruby. but now i use following addition to the git hook on the server: ``` [ -f "$TMP_GIT_CLONE/art/thumbs.sh" ] && { dir="$PWD" cd "$TMP_GIT_CLONE/art/" && sh thumbs.sh && cd "$dir" } ``` it happens after cloning to remote repo and before building with bundle. overall, this is a bodge now, it recompiles all thumbnails every time due to quirks in my current setup.
Diffstat (limited to '_includes')
-rw-r--r--_includes/art-menu.html4
-rw-r--r--_includes/pic-path.html20
2 files changed, 21 insertions, 3 deletions
diff --git a/_includes/art-menu.html b/_includes/art-menu.html
index d74d9da..0d35b96 100644
--- a/_includes/art-menu.html
+++ b/_includes/art-menu.html
@@ -1,12 +1,12 @@
<ul class="art-menu">
{%- for page in site.pages -%}
- {%- assign pagedir = page.dir | remove_first: "/" | split: "/" -%}
{%- include pic-path.html -%}
+ {%- assign pagedir = page.dir | remove_first: "/" | split: "/" -%}
{%- if pagedir.first == "art" and pagedir.size > 1 -%}
<li class="art-category">
<a class="link-mask" href="{{ page.url }}">{{ page.title }}</a>
<div class="thumbnail">
- <img src="{{ artpics.first }}">
+ <img src="{{ artthumbs.first }}">
</div>
</li>
{% endif %}
diff --git a/_includes/pic-path.html b/_includes/pic-path.html
index fed2367..810f227 100644
--- a/_includes/pic-path.html
+++ b/_includes/pic-path.html
@@ -1,8 +1,26 @@
+{% comment %}
+ the purpose of this file is to provide arrays to use for art browsing
+{% endcomment %}
+
{%- capture arts -%}
{%- for file in site.static_files -%}
- {%- if file.art and file.path contains page.title -%}
+ {%- if file.art and file.path contains page.title and file.thumbnail != true -%}
{{ file.path }}
{% endif %}
{%- endfor -%}
{%- endcapture -%}
{% assign artpics = arts | split: " " %}
+
+{%- capture arts_thumbs -%}
+{%- for art in artpics -%}
+ {%- assign art_ext = art | split: "." | last -%}
+ {%- assign art_basepath = art | split: "." | first -%}
+ {%- assign art_name = art_basepath | split: "/" | last -%}
+ {%- assign art_thumbpath = art_basepath \
+ | remove: art_name | append: "thumbs/" \
+ | append: art_name | append: "_thumb." | append: art_ext \
+ | append: " " -%}
+ {{ art_thumbpath }}
+{%- endfor -%}
+{%- endcapture -%}
+{% assign artthumbs = arts_thumbs | split: " " %}