Skip to content

Commit

Permalink
Add support for nav_order and Fix hardcoded navbar titles (alshediv…
Browse files Browse the repository at this point in the history
  • Loading branch information
rohandebsarkar authored and semicolonsnet committed Oct 24, 2022
1 parent 7f9a2e8 commit 5b9b868
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ email: chase@semicolons.net
description: > # the ">" symbol means to ignore newlines until "footer_text:"
Public scholarship on the instruction and assessment strategies that drive educational equity and innovation.
footer_text: >
icon: 🏫 # the emoji used as the favicon
url: https://semicolons.net # the base hostname & protocol for your site
baseurl: # the subpath of your site, e.g. /blog/
Expand Down
22 changes: 14 additions & 8 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<!-- Nav Bar -->
<nav id="navbar" class="navbar navbar-light navbar-expand-sm {% if site.navbar_fixed %}fixed-top{% else %}sticky-top{% endif %}">
<div class="container">
{% if page.title != "about" -%}
{% if page.permalink != '/' -%}
<a class="navbar-brand title font-weight-lighter" href="{{ site.baseurl | prepend: site.url }}/">
{%- if site.title == "blank" -%}<span class="font-weight-bold">{{ site.first_name }}</span> {{ site.middle_name }} {{ site.last_name }}{%- else -%}{{ site.title }}{%- endif -%}
</a>
Expand All @@ -65,27 +65,33 @@
<div class="collapse navbar-collapse text-right" id="navbarNav">
<ul class="navbar-nav ml-auto flex-nowrap">

{%- for page in site.pages -%}
{% if page.permalink == '/' %}
{% assign about_title = page.title %}
{% endif %}
{% endfor %}

<!-- About -->
<li class="nav-item {% if page.title == 'about' %}active{% endif %}">
<a class="nav-link" href="{{ '/' | relative_url }}">about
{%- if page.title == "about" -%}
<li class="nav-item {% if page.permalink == '/' %}active{% endif %}">
<a class="nav-link" href="{{ '/' | relative_url }}">{{ about_title }}
{%- if page.permalink == '/' -%}
<span class="sr-only">(current)</span>
{%- endif -%}
</a>
</li>
{% if site.blog_name %}
{% if site.blog_nav_title %}
<!-- Blog -->
<li class="nav-item {% if page.url contains 'blog' %}active{% endif %}">
<a class="nav-link" href="{{ '/blog/' | relative_url }}">blog
{%- if page.title == "blog" -%}
<a class="nav-link" href="{{ '/blog/' | relative_url }}">{{ site.blog_nav_title }}
{%- if page.url contains 'blog' -%}
<span class="sr-only">(current)</span>
{%- endif -%}
</a>
</li>
{%- endif %}

<!-- Other pages -->
{%- assign sorted_pages = site.pages | sort: "title" -%}
{%- assign sorted_pages = site.pages | sort: "nav_order" -%}
{%- for p in sorted_pages -%}
{%- if p.nav and p.autogen == nil -%}
{%- if p.dropdown %}
Expand Down
6 changes: 4 additions & 2 deletions _includes/metadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
{%- else -%}
{%- capture title -%}{{ site.title }}{%- endcapture -%}
{%- endif -%}
{%- if page.title != "blank" and page.url != "/" -%}
{{ title }} | {{ page.title }}
{% if page.url == '/blog/index.html' %}
{{ site.blog_nav_title }} | {{ title }}
{%- elsif page.title != "blank" and page.url != "/" -%}
{{ page.title }} | {{ title }}
{%- else -%}
{{ title }}
{%- endif -%}
Expand Down
13 changes: 13 additions & 0 deletions _pages/dropdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: page
title: submenus
nav: true
nav_order: 3
dropdown: true
children:
- title: publications
permalink: /publications/
- title: divider
- title: projects
permalink: /projects/
---
1 change: 1 addition & 0 deletions _pages/publications.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ title: publications
description:
years: [2022,2021,2020,2019,2018,2016,2015]
nav: true
nav_order: 2
---
<!-- _pages/publications.md -->
<div class="publications">
Expand Down

0 comments on commit 5b9b868

Please sign in to comment.