Skip to content

Commit

Permalink
Merge branch '1-highlighting-the-active-navigation-item-doesn-t-work-…
Browse files Browse the repository at this point in the history
…when-pretty-permalink-are-used' into 'master'


Resolve "Highlighting the active navigation item doesn't work when pretty permalink are used"

Closes #1

See merge request !1
  • Loading branch information
felnne committed Mar 14, 2017
2 parents 64319d4 + 177ffb7 commit 52eb298
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

## [Unreleased][unreleased]

## 0.1.2 - 14/03/2017

### Fixed

* Active site navigation item support when using 'pretty' permalinks

## 0.1.1 - Skipped

## 0.1.0 - 12/03/2017

### Added
Expand Down
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ encoding: UTF-8

baseurl: "" # e.g. /foo
url: "http://localhost:9000" # base hostname & protocol for canonical links
permalink: pretty

title: BAS Style Kit Jekyll Theme
description: > # Jekyll theme implementation of the BAS Style Kit - https://stlye-kit.web.bas.ac.uk.
Expand Down
18 changes: 12 additions & 6 deletions _includes/layout/site-navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
{% for item in site.nav_items %}
{% comment %} Single navbar items {% endcomment %}
{% if item.type == 'single_item' %}
{% assign page_url = page.url | remove: '.html' %}
<li {% if page_url == item.href %} class="active"{% endif %}>
{% if page_url == item.url %}<span class="sr-only">(current)</span>{% endif %}
{% assign page_url = page.url | remove: '.html' %}
{% assign item_url = item.href | append: '/' %}
<li {% if page_url == item.href %}class="active"{% endif %} {% unless page_url == '/' %}{% unless item.href == '/' %}{% if page_url == item_url %} class="active"{% endif %}{% endunless %}{% endunless %}>
{% if page_url == item.href %}<span class="sr-only">(current)</span>{% endif %} {% unless page_url == '/' %}{% unless item.href == '/' %}{% if page_url + '/' == item.href %}<span class="sr-only">(current)</span>{% endif %}{% endunless %}{% endunless %}
<a href="{{ item.href }}">{{ item.name }}</a>
</li>

Expand All @@ -30,16 +31,21 @@
{% if page_url == action.href %}
{% assign is_active = true %}
{% endif %}
{% assign action_url = action.href | append: '/' %}
{% if page_url == action_url %}
{% assign is_active = true %}
{% endif %}
{% endfor %}
<li class="dropdown {% if is_active %}active{% endif %}">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
{% if is_active %}<span class="sr-only">(current)</span>{% endif %}
{{ item.name }} <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-bsk">
{% for action in item.actions %}
<li {% if page_url == action.href %} class="active"{% endif %}>
{% if page_url == action.href %}<span class="sr-only">(current)</span>{% endif %}
<a href="{{ action.href }}">{{ action.name }}</a>
{% assign action_url = action.href | append: '/' %}
<li {% if page_url == action.href %}class="active"{% endif %} {% unless page_url == '/' %}{% unless action.href == '/' %}{% if page_url == action_url %} class="active"{% endif %}{% endunless %}{% endunless %}>
{% if page_url == action.href %}class="active"{% endif %} {% unless page_url == '/' %}{% unless action.href == '/' %}{% if page_url == action_url %}<span class="sr-only">(current)</span>{% endif %}{% endunless %}{% endunless %}
<a href="{{ action.href }}">{{ action.name }}</a>
</li>
{% endfor %}
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: '2'
services:
app:
build: .
image: docker-registry.data.bas.ac.uk/bsk/bas-style-kit-jekyll-theme:0.1.0-alpine
image: docker-registry.data.bas.ac.uk/bsk/bas-style-kit-jekyll-theme:0.1.2-alpine
volumes:
- .:/usr/src/app
ports:
Expand Down
2 changes: 1 addition & 1 deletion jekyll-theme-bas-style-kit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "jekyll-theme-bas-style-kit"
spec.version = "0.1.1"
spec.version = "0.1.2"
spec.authors = ["Felix Fennell"]
spec.email = ["[email protected]"]

Expand Down

0 comments on commit 52eb298

Please sign in to comment.