Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Page Order in NavBar #526

Closed
emalgorithm opened this issue Jan 13, 2022 · 4 comments · Fixed by #664
Closed

Custom Page Order in NavBar #526

emalgorithm opened this issue Jan 13, 2022 · 4 comments · Fixed by #664

Comments

@emalgorithm
Copy link

In the navigation bar, the order of the pages is defined by sorting alphabetically: {%- assign sorted_pages = site.pages -%}.
Is there an easy way to specify a different order?

@babaknasr
Copy link

checkout my workaround in following commit:
babaknasr@d900a98

I added a new tag "sort_menu" for each page using numbers and then sorted based on "sort_menu":
{% assign sorted_pages = site.pages | sort: "sort_menu" %}
by changing the value of the tag, manually you can manipulate the order of menu items.

@bchao1
Copy link

bchao1 commented Mar 6, 2022

Isn't there an order tag for each page already?

@emalgorithm
Copy link
Author

@bchao1 Do you have an example for that?

@bchao1
Copy link

bchao1 commented Apr 13, 2022

Not sure which version you're using, In my case, line 39 in _includes/header.html specifies that the tabs in the navbar is sorted using the order attribute:

{%- assign sorted_pages = site.pages | sort: "order" -%}

So, you can simply add the order attribute in each markdown file in _pages to change the ordering. Example:

---
layout: page
permalink: /publications/
title: publications
order: 2
description: Brian Chao's publications.
years: [2022, 2021, 2020]
nav: true
---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants