1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-12-12 14:47:25 +01:00
gojekyll/example/collections.html
Oliver Steele 3ded951bff Define page and static_file variables
* Define page.draft, page.slug, file.collection
* static_file.{name, basename} use basename
* page.id is based on the permalink, not the pathname
2017-08-20 12:56:23 -04:00

74 lines
1.6 KiB
HTML

---
---
<h1>Collections</h1>
<dl>
{% for c in site.collections %}
{% capture ks %}{% for k in c %}{{ k }} {% endfor %}{% endcapture %}
{% assign ks = ks | split: ' ' | sort %}
<dt> {{ c.label }}</dt>
<dd>Keys: {{ ks | join }}</dd>
<dd>
<table>
{% for k in ks %}
<tr>
<th style="text-align: left; vertical-align: top">{{ k }}</th>
{% if k != 'docs' %}
<td>{{ c[k] }}</td>
{% endif %}
</tr>
{% endfor %}
</table>
</dd>
{% endfor %}
</dl>
<h2>Collection Page</h2>
{% assign p = site.c1.first %}
{% capture ks %}{% for k in p %}{{ k }} {% endfor %}{% endcapture %}
{% assign ks = ks | split: ' ' | sort %}
Keys: {{ ks | join }}
<table>
{% for k in ks %}
<tr>
<th style="text-align: left; vertical-align: top">{{ k }}</th>
<td><pre>{{ p[k] }}</pre></td>
</tr>
{% endfor %}
</table>
<h2>Post</h2>
{% assign p = site.posts.first %}
{% capture ks %}{% for k in p %}{{ k }} {% endfor %}{% endcapture %}
{% assign ks = ks | split: ' ' | sort %}
Keys: {{ ks | join }}
<table>
{% for k in ks %}
<tr>
<th style="text-align: left; vertical-align: top">{{ k }}</th>
<td><pre>{{ p[k] }}</pre></td>
</tr>
{% endfor %}
</table>
<h2>Static File</h2>
{% assign d = site.static_files.first %}
{% capture ks %}{% for k in d %}{{ k }} {% endfor %}{% endcapture %}
{% assign ks = ks | split: ' ' | sort %}
Keys: {{ ks | join }}
<table>
{% for k in ks %}
<tr>
<th style="text-align: left; vertical-align: top">{{ k }}</th>
<td><pre>{{ d[k] }}</pre></td>
</tr>
{% endfor %}
</table>