Use data file to maintain site navigation
- Remove top navigation links from _config.yml
This commit is contained in:
parent
cf086c3873
commit
f4869f79c4
3 changed files with 21 additions and 16 deletions
13
_config.yml
13
_config.yml
|
@ -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
13
_data/navigation.yml
Normal 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
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue