Skip to content

Commit

Permalink
Build all navigations from _data/*.yml
Browse files Browse the repository at this point in the history
Converts footer links to the .yml data
  • Loading branch information
belbiy committed Oct 8, 2018
1 parent c5799e3 commit 7d8f5b6
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 31 deletions.
21 changes: 21 additions & 0 deletions _data/footer-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- label: Become a Contributor
url: https://github.com/magento/devdocs/blob/master/.github/CONTRIBUTING.md

- label: Glossary
url: https://magento.github.io/glossary/index.html?audience=developer

- label: Privacy Policy
url: https://magento.com/legal/terms/privacy/

- label: Terms of Service
url: https://magento.com/legal/terms/

- label: License/Trademark FAQ
url: https://magento.com/legal/licensing/

- label: Release Notes
url: /release-notes/bk-release-notes.html

- label: Third-Party Licenses
url: /magento-third-party.html
versionless: true
22 changes: 5 additions & 17 deletions _includes/layout/footer-links.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
{% assign items = site.data.footer-links %}

<ul class="nav footer-links">
<li><a href="https://github.com/magento/devdocs/blob/master/.github/CONTRIBUTING.md">Become a Contributor</a>
<li><a href="https://magento.github.io/glossary/index.html?audience=developer">Glossary</a></li>
<li><a href="http://magento.com/legal/terms/privacy/">Privacy Policy</a></li>
<li><a href="http://magento.com/legal/terms/">Terms of Service</a></li>
<li><a href="http://magento.com/legal/licensing/">License/Trademark FAQ</a></li>
<!-- If the page is in the root, the link points to the default version of release notes.
The default version is set in the config.yaml.
{%- capture release-notes -%}
{%- unless page.baseurl == empty -%}
{{page.baseurl}}/release-notes/bk-release-notes.html
{%- else -%}
/guides/v{{ site.version }}/release-notes/bk-release-notes.html
{%- endunless -%}
{%- endcapture -%}
-->
<li><a href="{{release-notes}}">Release Notes</a></li>
<li><a href="{{ site.baseurl }}/magento-third-party.html">Third-Party Licenses</a></li>
{% for item in items %}
{% include layout/nav-item.html section=item %}
{% endfor %}
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@
{% assign compare_url = page.url | prepend: site.baseurl %}
<li class="{% if compare_url == item_url %}active{% endif %} {{ item.class }}">
{% if item.url %}
<a href="{{ item_url }}">{{ item.label }}</a>
<a href="{{ item_url }}">{{ item.label }}</a>
{% else %}
<span>{{ item.label }}</span>
<span>{{ item.label }}</span>
{% endif %}

{% if children %}
<ul>
{% for child in children %}
{% include layout/toc-entry.html section=child %}
{% endfor %}
</ul>
<ul>
{% for child in children %}
{% include layout/nav-item.html section=child %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions _includes/layout/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<div class="nav-section-title">{{ subsection.label }}</div>
<ul>
{% for item in subchildren %}
{% include layout/main-nav-item.html item=item %}
{% include layout/nav-item.html section=item %}
{% endfor%}
</ul>
</div>
{% else if %}
{% include layout/main-nav-item.html item=subsection %}
{% include layout/nav-item.html section=subsection %}
{% endif %}
{% endfor %}
{% endcapture %}
Expand All @@ -47,4 +47,4 @@

{% endfor %}

</ul><!-- /.nav-main -->
</ul><!-- /.nav-main -->
6 changes: 3 additions & 3 deletions _includes/layout/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<div class="sidebar-wrapper">

{% assign toc = site.data.toc[page.group] %}

<h4 class="guide-title">{{ toc.label }}</h4>
<div class="collapsible-navigation">
<ul>
{% for entry in toc.pages %}
{% include layout/toc-entry.html section=entry %}
{% include layout/nav-item.html section=entry %}
{% endfor %}
</ul>
</div>

</div>

</aside>
<!-- /sidebar -->
<!-- /sidebar -->

0 comments on commit 7d8f5b6

Please sign in to comment.