From 48f91311b683be454a3481af7ee84314df0124ab Mon Sep 17 00:00:00 2001 From: Adam Schmideg Date: Tue, 19 Feb 2019 10:44:13 +0100 Subject: [PATCH] Use more sophisticated link and title includes --- _includes/link.html | 1 + _includes/title.html | 1 + _layouts/sidebar.html | 29 ++++++++++++----------------- 3 files changed, 14 insertions(+), 17 deletions(-) create mode 100644 _includes/link.html create mode 100644 _includes/title.html diff --git a/_includes/link.html b/_includes/link.html new file mode 100644 index 0000000000..47b146d5a5 --- /dev/null +++ b/_includes/link.html @@ -0,0 +1 @@ +{{ include.url | remove: ".html" | prepend: site.baseurl | replace: '//', '/' }} \ No newline at end of file diff --git a/_includes/title.html b/_includes/title.html new file mode 100644 index 0000000000..09d443c629 --- /dev/null +++ b/_includes/title.html @@ -0,0 +1 @@ +{{ include.doc.title | remove_first: include.coll.label | remove_first: "/ " }} \ No newline at end of file diff --git a/_layouts/sidebar.html b/_layouts/sidebar.html index 2b9d260251..8b33b57a47 100644 --- a/_layouts/sidebar.html +++ b/_layouts/sidebar.html @@ -1,26 +1,21 @@ --- layout: default --- -{% for coll in site.collections %} - {% if coll.sidebar %} -

{{ coll.caption }}

- {% for page in coll.docs %} -

{{ page.title | remove_first: coll.label | remove_first: '/ '}}

- {% endfor %} - {% endif %} -{% endfor %}
- {% for group in site.data.sidebar %} -
- {{ group[0] }} - {% for link in group[1] %} - - {{ link.first[0] }} - {% endfor %} -
+ {% for coll in site.collections %} + {% if coll.sidebar %} +
+ {{ coll.caption }} + {% for doc in coll.docs %} + {% capture url %}/{{ site.collections_dir}}/{{ doc.url }}{% endcapture %} + + {% include title.html doc=doc coll=coll %} + {% endfor %} +
+ {% endif %} {% endfor %}