diff --git a/site/_includes/section_nav.html b/site/_includes/section_nav.html index c7b60647..2016997e 100644 --- a/site/_includes/section_nav.html +++ b/site/_includes/section_nav.html @@ -1,25 +1,16 @@ {% comment %} -Lets turn our yaml into a structured list of documents without titles. +Map grabs the doc sections, giving us an array of arrays. Join, flattens all +the items to a comma delimited string. Split turns it into an array again. {% endcomment %} - -{% assign docs = site.data.docs | map: 'docs' %} -{% capture document_array_string %} -{% for doc in docs %} - {% assign last_last = forloop.last %} - {% for title in doc %} - {{title}}{% unless forloop.last and last_last %},{% endunless %} - {% endfor %} -{% endfor %} -{% endcapture %} -{% assign document_array = document_array_string | strip_newlines | split: ',' %} +{% assign docs = site.data.docs | map: 'docs' | join: ',' | split: ',' %} {% comment %} -Because this is built for every page, lets find where we are in the document list by comparing url strings. -Then if there's something previous or next, lets build links to it. -Note: When arrays are accessed directly, they are zero based. +Because this is built for every page, lets find where we are in the ordered +document list by comparing url strings. Then if there's something previous or +next, lets build a link to it. {% endcomment %} -{% for document in document_array %} +{% for document in docs %} {% assign document_url = document | prepend:"/docs/" | append:"/" %} {% if document_url == page.url %}