Make header more efficient

When adding class for current page on navbar
This commit is contained in:
2020-12-29 00:22:14 +00:00
parent 04edf181b2
commit ff87167fe9
6 changed files with 57 additions and 62 deletions

View File

@@ -10,14 +10,13 @@
<!-- Nav -->
<nav id="menu">
<ul class="links">
<li><a href="/" {% if page.url == "/" or page.url == "/index.html" %} class="current-page-link" {% endif %}>Home</a></li>
<li><a href="/" class="{% if page.url == '/' or page.url == '/index.html' %}current-page-link{% endif %}">Home</a></li>
{% assign all_pages = site.pages | concat: site.data.navigation | sort: "title" %}
{% for project in all_pages %}
{% assign project_url_end = project.url| slice: -4, 4 %}
{% if project.url != "/" and project.url != "/index.html" and project.url != "/sitemap.xml" and project_url_end != ".css" %}
<li><a href="{{ project.url | relative_url }}" {% if project.url == page.url %} class="current-page-link"
{% endif %}>{{ project.title }}</a></li>
<li><a href="{{ project.url | relative_url }}" class="{% if project.url == page.url %}current-page-link{% endif %}">{{ project.title }}</a></li>
{% endif %}
{% endfor %}
</ul>