Skip to content

Commit

Permalink
Now blog can be reorganized in header (alshedivat#1996)
Browse files Browse the repository at this point in the history
Fixes alshedivat#1559 alshedivat#1795

Signed-off-by: George Araújo <george.gcac@gmail.com>
  • Loading branch information
george-gca authored and CalaW committed Feb 9, 2024
1 parent fcc61b6 commit 1e6697a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ bing_site_verification: # out your bing-site-verification ID (Bing Webmaster)
# -----------------------------------------------------------------------------

blog_name: # blog_name will be displayed in your blog page, disable block
blog_nav_title: # your blog must have a title for it to be displayed in the nav bar
blog_description:
permalink: /blog/:year/:title/

Expand Down
21 changes: 8 additions & 13 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@
{%- endif -%}
</a>
</li>
{% 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 }}">{{ 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: "nav_order" -%}
Expand Down Expand Up @@ -90,9 +80,14 @@
</div>
</li>
{%- else %}
<li class="nav-item {% if page.title == p.title %}active{% endif %}">
<a class="nav-link" href="{{ p.url | relative_url }}">{{ p.title }}
{%- if page.title == p.title -%}
<li class="nav-item {% if page.url contains p.permalink %}active{% endif %}">
{%- if p.permalink contains '/blog/' %}
{%- assign url = '/blog/' -%}
{%- else -%}
{%- assign url = p.url -%}
{%- endif -%}
<a class="nav-link" href="{{ url | relative_url }}">{{ p.title }}
{%- if page.url contains p.url -%}
<span class="sr-only">(current)</span>
{%- endif -%}
</a>
Expand Down
2 changes: 1 addition & 1 deletion _includes/metadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{%- capture title -%}{{ site.title }}{%- endcapture -%}
{%- endif -%}
{% if page.url == '/blog/index.html' %}
{{ site.blog_nav_title }} | {{ title }}
{{ page.title }} | {{ title }}
{%- elsif page.title != "blank" and page.url != "/" -%}
{%- if page.title == nil or page.title == "" -%}
{{ page.date | date: "%Y" }} | {{ title }}
Expand Down
3 changes: 3 additions & 0 deletions blog/index.html → _pages/blog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
layout: default
permalink: /blog/
title: blog
nav: true
nav_order: 1
pagination:
enabled: true
collection: posts
Expand Down
2 changes: 1 addition & 1 deletion _pages/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Projects
permalink: /projects/
description: A growing collection of my cool projects.
nav: true
nav_order: 2
nav_order: 3
display_categories: [work, fun]
horizontal: true
---
Expand Down
2 changes: 1 addition & 1 deletion _pages/publications.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ permalink: /publications/
title: Publications
description: publications by categories in reversed chronological order. generated by jekyll-scholar.
nav: true
nav_order: 1
nav_order: 2
---
<!-- _pages/publications.md -->
<div class="publications">
Expand Down

0 comments on commit 1e6697a

Please sign in to comment.