From 0a22ac3452d6fc25ea0b422188d20991a5b2da58 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 28 Feb 2018 00:24:24 +0100 Subject: Fix all links and advertize IPFS version --- 18/index.html | 10 +++++----- _includes/head.html | 9 ++++----- _includes/header.html | 13 ++++++------- _includes/relBase.html | 8 -------- _layouts/random-project.html | 5 ++--- _layouts/slides.html | 5 ++--- _plugins/relativize_url.rb | 34 ++++++++++++++++++++++++++++++++++ articles/index.md | 7 ++++++- articles/projects.md | 4 ++-- articles/random-projects.md | 4 ++-- 10 files changed, 63 insertions(+), 36 deletions(-) delete mode 100644 _includes/relBase.html create mode 100644 _plugins/relativize_url.rb diff --git a/18/index.html b/18/index.html index 3289b6a..e726d2b 100644 --- a/18/index.html +++ b/18/index.html @@ -8,12 +8,12 @@ 18. - + - - - + + +
@@ -63,6 +63,6 @@

Noah.

- + diff --git a/_includes/head.html b/_includes/head.html index 9bedb01..05e0c13 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -1,16 +1,15 @@ -{% include relBase.html %} Noah Loomans - + - - - + + + {% if page.info %} diff --git a/_includes/header.html b/_includes/header.html index eb46a8e..a6bdaab 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -1,8 +1,7 @@ -{% include relBase.html %}
@@ -11,10 +10,10 @@ diff --git a/_includes/relBase.html b/_includes/relBase.html deleted file mode 100644 index b2d4bc4..0000000 --- a/_includes/relBase.html +++ /dev/null @@ -1,8 +0,0 @@ -{% assign relBase = '' %} -{% assign tempDepth = page.url | append: 'hackish-solution' | split: '/' | size | minus: 2 %} -{% for i in (1..tempDepth) %} - {% assign relBase = relBase | append: "../" %} -{% endfor %} -{% if relBase == '' %} - {% assign relBase = './' %} -{% endif %} diff --git a/_layouts/random-project.html b/_layouts/random-project.html index bae9a24..88c763b 100644 --- a/_layouts/random-project.html +++ b/_layouts/random-project.html @@ -1,6 +1,5 @@ --- --- -{% include relBase.html %} {% include head.html %} @@ -8,11 +7,11 @@ {% if page.branding == true %}
Random Project
- Go to main site + Go to main site
{% endif %} {{ content }} diff --git a/_layouts/slides.html b/_layouts/slides.html index 47be94e..4c902ab 100644 --- a/_layouts/slides.html +++ b/_layouts/slides.html @@ -1,10 +1,9 @@ -{% include relBase.html %} {{ page.title }} - + {% for style in page.styles %} @@ -12,7 +11,7 @@ {{ content }} - + {% for script in page.scripts %} {% endfor %} diff --git a/_plugins/relativize_url.rb b/_plugins/relativize_url.rb new file mode 100644 index 0000000..23e1712 --- /dev/null +++ b/_plugins/relativize_url.rb @@ -0,0 +1,34 @@ +require 'pathname' + +module Jekyll + module UrlRelativizer + # def relativize_url(url) + # pageUrl = @context.registers[:page]["url"] + # if pageUrl[-1] == "/" + # pageDir = Pathname(pageUrl) + # else + # pageDir = Pathname(pageUrl).parent + # end + # ret = Pathname(url).relative_path_from(pageDir).to_s + # puts pageDir.to_s + + " -> " + url.to_s + " => " + ret + # ret + # end + + def relativize_url(input) + return if input.nil? + input = ensure_leading_slash(input) + page_url = @context.registers[:page]["url"] + if page_url[-1] + page_dir = Pathname(page_url) + else + page_dir = Pathname(page_url).parent + end + + ret = Pathname(input).relative_path_from(page_dir).to_s + # puts page_url.to_s + "," + page_dir.to_s + + "," + input.to_s + "," + ret + return ret + end + end +end + +Liquid::Template.register_filter(Jekyll::UrlRelativizer) diff --git a/articles/index.md b/articles/index.md index 0a125ad..3a0bdc3 100644 --- a/articles/index.md +++ b/articles/index.md @@ -5,11 +5,16 @@ permalink: / Hi, I'm a programmer, mostly a web developer, but I'm in love with robotics as well. -I just like to code stuff. Take a look at the [projects page](/projects/) to see +I just like to code stuff. Take a look at the [projects page]({{ "/projects/" | relativize_url }}) to see the stuff I've been working on. I'm currently a 18 year old student at [Metis Montessori Lyceum](http://hetmml.nl/), and I currently have a job at 241SoftwareSolutions. +# IPFS +This site is also available on [IPFS](https://ipfs.io/)! It can be viewed at [/ipns/noahloomans.com](https://ipfs.io/ipns/noahloomans.com). + +To use IPFS, simply install [IPFS Desktop](https://github.com/ipfs-shipyard/ipfs-desktop/releases), and the IPFS Companion browser extension ([Firefox](https://addons.mozilla.org/en-US/firefox/addon/ipfs-companion/)/[Chrome](https://chrome.google.com/webstore/detail/ipfs-companion/nibjojkomfdiaoajekhjakgkdhaomnch)). + # Contact If you wish to contact me please send me an email at [noahloomans@gmail.com](mailto:noahloomans@gmail.com). And you can find my PGP diff --git a/articles/projects.md b/articles/projects.md index 9866b51..4607276 100644 --- a/articles/projects.md +++ b/articles/projects.md @@ -10,11 +10,11 @@ and I really enjoy making them, here are some of my favorites: diff --git a/articles/random-projects.md b/articles/random-projects.md index d788b81..00f8006 100644 --- a/articles/random-projects.md +++ b/articles/random-projects.md @@ -5,8 +5,8 @@ permalink: /random-projects/ These are some of the random project I've made: - - [Bad Password Generator]({{ relBase }}random-projects/bad-password-generator/) - - [Season 3 Countdown]({{ relBase }}random-projects/season3-countdown/) + - [Bad Password Generator]({{ "/random-projects/bad-password-generator/" | relativize_url }}) + - [Season 3 Countdown]({{ "/random-projects/season3-countdown/" | relativize_url }}) The source code of all of them can be found on [GitLab](https://gitlab.com/nloomans/noahloomans.com/tree/master/random-projects). -- cgit v1.1