Add support for nav_order and Fix hardcoded navbar titles (#664)

This commit is contained in:
Rohan Deb Sarkar 2022-05-13 00:37:04 +05:30 committed by GitHub
parent 503bfc235a
commit 8db7daf356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 11 deletions

View File

@ -84,7 +84,8 @@ panelbear_analytics: # panelbear analytics site ID (format: XXXXXXXXX)
# Blog
# -----------------------------------------------------------------------------
blog_name: al-folio # 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/

View File

@ -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>
@ -25,19 +25,25 @@
<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>
@ -45,7 +51,7 @@
{%- 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 %}

View File

@ -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 -%}

View File

@ -2,6 +2,7 @@
layout: page
title: submenus
nav: true
nav_order: 3
dropdown: true
children:
- title: publications

View File

@ -4,6 +4,7 @@ title: projects
permalink: /projects/
description: A growing collection of your cool projects.
nav: true
nav_order: 1
display_categories: [work, fun]
horizontal: false
---

View File

@ -5,6 +5,7 @@ title: publications
description: publications by categories in reversed chronological order. generated by jekyll-scholar.
years: [1956, 1950, 1935, 1905]
nav: true
nav_order: 2
---
<!-- _pages/publications.md -->
<div class="publications">

View File

@ -4,6 +4,7 @@ permalink: /teaching/
title: teaching
description: Materials for courses you taught. Replace this text with your description.
nav: true
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.