From 1855280bbdbe7c7cb52b225ac4c93c72eb18753b Mon Sep 17 00:00:00 2001 From: Oliver Steele Date: Sun, 20 Aug 2017 11:39:37 -0400 Subject: [PATCH] Sort keys in collection variable examples --- example/collections.html | 100 ++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 32 deletions(-) diff --git a/example/collections.html b/example/collections.html index 180c0ad..b1c2a16 100644 --- a/example/collections.html +++ b/example/collections.html @@ -3,35 +3,71 @@

Collections

-{% for c in site.collections %} -

{{ c.label }}

- - {% for k in c %}{% if k != 'docs' %} - - {% endif %}{% endfor %} - -
{{k}}{{c[k]}}
docs -
    - {% for p in c.docs %} -
  • {{ p.path }} - - {% for k in p %} - - - - - {% endfor %} - -
    {{k}}
    {{p[k]}}
    -
  • - {% endfor %} -
-
-{% endfor %} +
+ {% for c in site.collections %} + {% capture ks %}{% for k in c %}{{ k }} {% endfor %}{% endcapture %} + {% assign ks = ks | split: ' ' | sort %} +
{{ c.label }}
+
Keys: {{ ks | join }}
+
+ + {% for k in ks %} + + + {% if k != 'docs' %} + + {% endif %} + + {% endfor %} +
{{ k }}{{ c[k] }}
+
+ {% endfor %} +
+ +

Collection Page

+ +{% assign p = site.c1.first %} +{% capture ks %}{% for k in p %}{{ k }} {% endfor %}{% endcapture %} +{% assign ks = ks | split: ' ' | sort %} +Keys: {{ ks | join }} + + + {% for k in ks %} + + + + + {% endfor %} +
{{ k }}
{{ p[k] }}
+ +

Post

+ +{% assign p = site.posts.first %} +{% capture ks %}{% for k in p %}{{ k }} {% endfor %}{% endcapture %} +{% assign ks = ks | split: ' ' | sort %} +Keys: {{ ks | join }} + + + {% for k in ks %} + + + + + {% endfor %} +
{{ k }}
{{ p[k] }}
+ +

Static File

+ +{% assign d = site.static_files.first %} +{% capture ks %}{% for k in p %}{{ k }} {% endfor %}{% endcapture %} +{% assign ks = ks | split: ' ' | sort %} +Keys: {{ ks | join }} + + + {% for k in ks %} + + + + + {% endfor %} +
{{ k }}
{{ d[k] }}