diff --git a/_includes/navigation.html b/_includes/navigation.html index ab853aa3cd3a3358144b0f60920751a5890d53a1..2e0739da8e242653ef4cf1f528af5dcdf8510848 100644 --- a/_includes/navigation.html +++ b/_includes/navigation.html @@ -1,5 +1,5 @@ <nav> {% for item in site.data.navigation %} - <a href="{{ item.link }}" {% if page.url == item.link %}class="current"{% endif %}>{{ item.name }}</a> + <a href="{{ item.link | real_relative_url }}" {% if page.url == item.link %}class="current"{% endif %}>{{ item.name }}</a> {% endfor %} </nav> diff --git a/_layouts/default.html b/_layouts/default.html index ceef12e07b7168089b1b398c2aa59e9fc2c23eb7..2b0a996c29d8bffe660756beb87924678970f190 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <title>{{ page.title }}</title> - <link rel="stylesheet" href="/assets/css/styles.css"> + <link rel="stylesheet" href="{{ "/assets/css/styles.css" | real_relative_url }}"> {% include mathjax.html %} </head> <body> diff --git a/_plugins/real_relative_url.rb b/_plugins/real_relative_url.rb new file mode 100644 index 0000000000000000000000000000000000000000..37ceb8c3f5c24eb43a650f2701b6037ca89d4af4 --- /dev/null +++ b/_plugins/real_relative_url.rb @@ -0,0 +1,17 @@ +require 'pathname' + +# Jekyll's built-in "relative_url" filter does not generate relative URLs, it generates URLs that +# don't contain the domain. This plugin was posted to a GitHub issue in which @aioobe asks about +# making real relative URLs: https://github.com/jekyll/jekyll/issues/6360. + +module Jekyll + module RealRelativeUrl + def real_relative_url(url) + pageUrl = @context.registers[:page]["url"] + pageDir = Pathname(pageUrl).parent + Pathname(url).relative_path_from(pageDir).to_s + end + end +end + +Liquid::Template.register_filter(Jekyll::RealRelativeUrl) diff --git a/_sass/main.scss b/_sass/main.scss index bc25e9ec345e7f25206a42139085669d4ad800b9..9ecbc411044de9c0a2a0ce4c9e1a10bd49e941e9 100644 --- a/_sass/main.scss +++ b/_sass/main.scss @@ -1,3 +1,3 @@ .current { - color: green; + font-weight: bold; }