Skip to content

Commit

Permalink
Dynamically generate navigation menu.
Browse files Browse the repository at this point in the history
Former-commit-id: c5a69252c0517e55b2608ae344d723e74234ce38
  • Loading branch information
i2000s committed Mar 10, 2016
1 parent 2d08e6c commit 62a6909
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 27 deletions.
9 changes: 9 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ author :
- name: ICIQ
- name: JuliaCN
url: http://i2000s.github.io
navigation: # For the navigation menu. Don't use index.html. urls should end with a directory.
- text: Home
url: /
- text: Research
url: /research/
- text: Publications and Activities
url: /pubs/
- text: Community
url: /community/

permalink: /:year/:month/:day/:title.html
redirects: yes
Expand Down
37 changes: 10 additions & 27 deletions _includes/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,16 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
{% if page.url == "/index.html" %}<li class="active">{% else %}<li>{% endif %}
<a href="/index.html">Home</a></li>

{% if page.url == "/research.html" %}<li class="active">{% else %}<li>{% endif %}
<a href="/research.html">Research</a></li>

{% if page.url == "/pubs/index.html" %}<li class="active">{% else %}<li>{% endif %}
<a href="/pubs/index.html">Publications and Activities</a></li>

<!-- {% if page.url == "/noteblog.html" %}<li class="active">{% else %}<li>{% endif %}
<a href="/noteblog.html">Blog</a></li> -->

<!-- {% if page.url == "/notebooks.html" %}<li class="active">{% else %}<li>{% endif %}
<a href="{{ site.url }}/notebooks.html">Notebooks</a></li> -->

{% if page.url == "/community.html" %}<li class="active">{% else %}<li>{% endif %}
<a href="/community.html">Community</a></li>

<!-- {% if page.url == "/teaching.html" %}<li class="active">{% else %}<li>{% endif %}
<a href="{{ site.url }}/teaching.html">Learning</a></li> -->

<!--{% if page.url == "/tools.html" %}<li class="active">{% else %}<li>{% endif %}
<a href="/tools.html">Tools</a></li>
{% if page.url == "/philosophy.html" %}<li class="active">{% else %}<li>{% endif %}
<a href="/philosophy.html">Philosophy</a></li> -->

{% for item in site.navigation %}
{% assign class = nil %}
{% if page.url contains item.url and item.url != '/' %}
{% assign class = 'active' %}
{% endif %}
{% if page.url == '/' and item.url == '/' %}
{% assign class = 'active' %}
{% endif %}
<li><a href="{{ item.url }}" class="{{ class }}">{{ item.text }}</a></li>
{% endfor %}
</ul>
<!-- Search site using Google's index -->
<form class="navbar-form navbar-right" role="search" method="get" action="http://google.com/search">
Expand Down
1 change: 1 addition & 0 deletions community.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
layout: null
permalink: /community/
title: Community
subtitle: How science is done and for what.
description: Xiaodong's self-described contribution to the community.
Expand Down
1 change: 1 addition & 0 deletions research.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
layout: default
permalink: /research/
title: Research
subtitle: Do science in an open and collaborative way.
time: 2016-03-03 03:06:00.000000000 -07:00
Expand Down

0 comments on commit 62a6909

Please sign in to comment.