Skip to content

Commit

Permalink
Cleanup nav and header includes
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmitchell committed Apr 23, 2024
1 parent 461119f commit 7c1ba0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
{% for item in site.data.nav %}

{% assign item_title = item.title | smartify %}
{% assign item_url = item.url %}

<li{% if page.url == item_url %} class="selected"{% endif %}><a href="{{ item_url }}"{% if item.external %} target="_blank" rel="noopener"{% endif %} aria-label="{{ item_title }}">{{ item_title }}</a></li>
<li{% if item.url == page.url %} class="selected"{% endif %}><a href="{{ item.url | absolute_url }}"{% if item.external %} target="_blank" rel="noopener"{% endif %} aria-label="{{ item_title }}">{{ item_title }}</a></li>

{% endfor %}

Expand Down
12 changes: 5 additions & 7 deletions _includes/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% assign item_url = item.url %}

<li{% if page.url contains item_url %} class="selected"{% endif %}>
<a href="{{ item_url }}"{% if item.external %} target="_blank" rel="noopener"{% endif %} aria-label="{{ item_title }}">{{ item_title }}</a>
<a href="{{ item_url | absolute_url }}"{% if item.external %} target="_blank" rel="noopener"{% endif %} aria-label="{{ item_title }}">{{ item_title }}</a>

{% if item_url == '/docs/' %}

Expand All @@ -29,17 +29,16 @@

{% if doc_sections and doc.index == false %}

{% assign section_first = doc_sections | first %}
{% assign section_url = section_first.url %}
{% assign section_url = doc_sections.first.url %}

{% else %}

{% assign section_url = null %}
{% assign section_url = doc_url %}

{% endif %}

<li{% if page.url contains doc_url %} class="selected"{% endif %}>
<a href="{{ section_url | default: doc_url | absolute_url }}" aria-label="{{ doc_title }}">{{ doc_title }}</a>
<a href="{{ section_url | absolute_url }}" aria-label="{{ doc_title }}">{{ doc_title }}</a>

{% if page.url contains doc_url and doc_sections %}

Expand All @@ -48,9 +47,8 @@
{% for section in doc_sections %}

{% assign section_title = section.title | smartify %}
{% assign section_url = section.url %}

<li{% if section_url contains page.url %} class="selected"{% endif %}><a href="{{ section_url | absolute_url }}" aria-label="{{ section_title }}">{{ section_title }}</a></li>
<li{% if section.url contains page.url %} class="selected"{% endif %}><a href="{{ section.url | absolute_url }}" aria-label="{{ section_title }}">{{ section_title }}</a></li>

{% endfor %}

Expand Down

0 comments on commit 7c1ba0a

Please sign in to comment.