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 himanshuIndia committed Jan 16, 2024
1 parent c3463a2 commit baca395
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
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

0 comments on commit baca395

Please sign in to comment.