Use data file to maintain site navigation

- Remove top navigation links from _config.yml
This commit is contained in:
Michael Rose 2014-07-31 08:48:44 -04:00
parent cf086c3873
commit f4869f79c4
3 changed files with 21 additions and 16 deletions

View file

@ -32,19 +32,6 @@ google_verify:
# https://ssl.bing.com/webmaster/configure/verify/ownership Option 2 content= goes here
bing_verify:
# Links to include in top navigation
# For external links add external: true
links:
- title: About
url: /about/
- title: Posts
url: /posts/
- title: Theme Setup
url: /theme-setup/
- title: Made Mistakes
url: http://mademistakes.com
external: true
# http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
timezone: America/New_York
future: true

13
_data/navigation.yml Normal file
View file

@ -0,0 +1,13 @@
# Site navigation links
- title: About
url: /about/
- title: Sample Posts
url: /posts/
- title: Theme Setup
url: /theme-setup/
- title: Made Mistakes
url: http://mademistakes.com

View file

@ -5,8 +5,13 @@
<div class="top-navigation">
<nav role="navigation" id="site-nav" class="nav">
<ul>
{% for link in site.links %}
<li><a href="{% if link.external %}{{ link.url }}{% else %}{{ site.url }}{{ link.url }}{% endif %}" {% if link.external %}target="_blank"{% endif %}>{{ link.title }}</a></li>
{% for link in site.data.navigation %}
{% if link.url contains 'http' %}
{% assign domain = '' %}
{% else %}
{% assign domain = site.url %}
{% endif %}
<li><a href="{{ domain }}{{ link.url }}" {% if link.url contains 'http' %}target="_blank"{% endif %}>{{ link.title }}</a></li>
{% endfor %}
</ul>
</nav>