Skip to content

Commit

Permalink
refactor: Split nav links into an include
Browse files Browse the repository at this point in the history
  • Loading branch information
strogonoff committed Sep 4, 2018
1 parent 86a8060 commit 4e7dc1c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 32 deletions.
32 changes: 32 additions & 0 deletions _includes/nav-links.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% include nav-page-link.html url="/" title="Home" %}
{% assign contact_link = "mailto:" | append: site.contact_email %}

{% if site.is_hub %}
{% include nav-page-link.html url="/projects/" title="Open Projects" %}

{% if site.num_all_software > 0 %}
{% include nav-page-link.html url="/software/" title="Software" active_for_nested=true %}
{% endif %}
{% if site.num_all_specs > 0 %}
{% include nav-page-link.html url="/specs/" title="Specifications" active_for_nested=true %}
{% endif %}
{% if site.num_posts_combined > 0 %}
{% include nav-page-link.html url="/blog/" title="Blog" active_for_nested=true %}
{% endif %}

{% else %}
{% if site.num_all_software > 0 %}
{% include nav-page-link.html url="/software/" title="Software" active_for_nested=true %}
{% endif %}
{% if site.num_all_specs > 0 %}
{% include nav-page-link.html url="/specs/" title="Specifications" active_for_nested=true %}
{% endif %}

{% include project-nav.html %}

{% if site.num_posts_combined > 0 %}
{% include nav-page-link.html url="/blog/" title="Blog" active_for_nested=true %}
{% endif %}

{% include nav-page-link.html url=contact_link title="Contact" %}
{% endif %}
33 changes: 1 addition & 32 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,7 @@
<header>
<h1 class="site-logo"><a href="/">{% include logo.html %}</a></h1>
<nav>
{% include nav-page-link.html url="/" title="Home" %}
{% assign contact_link = "mailto:" | append: site.contact_email %}

{% if site.is_hub %}
{% include nav-page-link.html url="/projects/" title="Open Projects" %}

{% if site.num_all_software > 0 %}
{% include nav-page-link.html url="/software/" title="Software" active_for_nested=true %}
{% endif %}
{% if site.num_all_specs > 0 %}
{% include nav-page-link.html url="/specs/" title="Specifications" active_for_nested=true %}
{% endif %}
{% if site.num_posts_combined > 0 %}
{% include nav-page-link.html url="/blog/" title="Blog" active_for_nested=true %}
{% endif %}

{% else %}
{% if site.num_all_software > 0 %}
{% include nav-page-link.html url="/software/" title="Software" active_for_nested=true %}
{% endif %}
{% if site.num_all_specs > 0 %}
{% include nav-page-link.html url="/specs/" title="Specifications" active_for_nested=true %}
{% endif %}

{% include project-nav.html %}

{% if site.num_posts_combined > 0 %}
{% include nav-page-link.html url="/blog/" title="Blog" active_for_nested=true %}
{% endif %}

{% include nav-page-link.html url=contact_link title="Contact" %}
{% endif %}
{% include nav-links.html %}
</nav>
{% include social-links.html %}
</header>
Expand Down

0 comments on commit 4e7dc1c

Please sign in to comment.