summaryrefslogtreecommitdiffstats
path: root/projects.html
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2025-12-20 21:36:45 +0800
committerSadeep Madurange <sadeep@asciimx.com>2025-12-20 21:36:45 +0800
commite15f1076b59e997108914f6a5b9b28652d323268 (patch)
tree294b0c5da8f8410ad0aab89dd2c5d107f581e083 /projects.html
parent31616ee1b8ff316d6558a0e7c87e4bd4211c9932 (diff)
downloadwww-e15f1076b59e997108914f6a5b9b28652d323268.tar.gz
Change website structure to a log.
Diffstat (limited to 'projects.html')
-rw-r--r--projects.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/projects.html b/projects.html
new file mode 100644
index 0000000..5ebc056
--- /dev/null
+++ b/projects.html
@@ -0,0 +1,42 @@
+---
+layout: default
+title: Projects
+---
+
+<div class="container">
+ <h2>{{ page.title }}</h2>
+ <table>
+ {% assign n = 2 %}
+ {% assign projects = site.log | where: "project", true | sort: 'date' | reverse %}
+ {% assign rows = projects.size | divided_by: n %}
+
+ {% assign remainder = projects.size | modulo: n %}
+ {% if remainder != 0 %}
+ {% assign rows = rows | plus: 1 %}
+ {% endif %}
+
+ {% for i in (1..rows) %}
+ <tr>
+ {% assign offset = forloop.index0 | times: n %}
+ {% for item in projects limit:n offset:offset %}
+ <td class="project-item">
+ {% assign parts = item.url | split: '/' %}
+ <a href="../log/{{ parts[2] }}" class="link-decor-none">
+ <img src="../log/{{ parts[2] }}/{{ item.thumbnail }}" alt="{{ item.title }}">
+ <h5>{{ item.title }}</h5>
+ </a>
+ </td>
+ {% endfor %}
+
+ {%- comment -%}Fill empty cells if this is the last row and has odd number of items{%- endcomment -%}
+ {% if forloop.last %}
+ {% assign items_in_last_row = projects.size | minus: offset %}
+ {% assign empty_cells = n | minus: items_in_last_row %}
+ {% for j in (1..empty_cells) %}
+ <td class="project-item"></td>
+ {% endfor %}
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </table>
+</div>