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 horaciochacon committed Feb 28, 2023
1 parent bd2b35c commit d1286fb
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 11 deletions.
3 changes: 2 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ panelbear_analytics: # panelbear analytics site ID (format: XXXXXXXXX)
# Blog
# -----------------------------------------------------------------------------

blog_name: # your blog must have a name for it to show up in the nav bar
blog_name: al-folio # blog_name will be displayed in your blog page
blog_nav_title: blog # your blog must have a title for it to be displayed in the nav bar
blog_description: a simple whitespace theme for academics
permalink: /blog/:year/:title/

Expand Down
22 changes: 14 additions & 8 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,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 @@ -25,27 +25,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
1 change: 1 addition & 0 deletions _pages/dropdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: page
title: submenus
nav: true
nav_order: 3
dropdown: true
children:
- title: publications
Expand Down
1 change: 1 addition & 0 deletions _pages/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: projects
permalink: /projects/
description: A growing collection of your cool projects.
nav: false
nav_order: 1
display_categories: [work, fun]
horizontal: false
---
Expand Down
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: List of publications by Horacio Chacon-Torrico.
years: [2022,2021,2020,2019,2013]
nav: true
nav_order: 2
---
<!-- _pages/publications.md -->
<div class="publications">
Expand Down
1 change: 1 addition & 0 deletions _pages/teaching.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ permalink: /teaching/
title: teaching
description: Materials for courses you taught. Replace this text with your description.
nav: false
nav_order: 2
---

For now, this page is assumed to be a static description of your courses. You can convert it to a collection similar to `_projects/` so that you can have a dedicated page for each course.
Expand Down

0 comments on commit d1286fb

Please sign in to comment.