diff options
author | Noah Loomans <noahloomans@gmail.com> | 2018-02-28 00:24:24 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2018-02-28 00:24:24 +0100 |
commit | 0a22ac3452d6fc25ea0b422188d20991a5b2da58 (patch) | |
tree | bc9fcc7a043aee81dd4266e8a4469a551c3081e7 | |
parent | 1d000946313c5758b2935ed8cc9a64858172ff74 (diff) |
Fix all links and advertize IPFS version
-rw-r--r-- | 18/index.html | 10 | ||||
-rw-r--r-- | _includes/head.html | 9 | ||||
-rw-r--r-- | _includes/header.html | 13 | ||||
-rw-r--r-- | _includes/relBase.html | 8 | ||||
-rw-r--r-- | _layouts/random-project.html | 5 | ||||
-rw-r--r-- | _layouts/slides.html | 5 | ||||
-rw-r--r-- | _plugins/relativize_url.rb | 34 | ||||
-rw-r--r-- | articles/index.md | 7 | ||||
-rw-r--r-- | articles/projects.md | 4 | ||||
-rw-r--r-- | articles/random-projects.md | 4 |
10 files changed, 63 insertions, 36 deletions
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 @@ <link rel="stylesheet" href="https://opensource.keycdn.com/fontawesome/4.7.0/font-awesome.min.css" integrity="sha384-dNpIIXE8U05kAbPhy3G1cz+yZmTzA6CY8Vg/u2L9xRnHjJiAK76m2BIEaSEV+/aU" crossorigin="anonymous"> <title>18.</title> - <link rel="stylesheet" href="{{ relBase }}style/18.css"> + <link rel="stylesheet" href="{{ "/style/18.css" | relativize_url }}"> <!-- sigh... favicon --> - <link rel="apple-touch-icon" sizes="180x180" href="{{ relBase }}assets/icons/apple-touch-icon.png"> - <link rel="icon" type="image/png" href="{{ relBase }}assets/icons/favicon-32x32.png" sizes="32x32"> - <link rel="icon" type="image/png" href="{{ relBase }}assets/icons/favicon-16x16.png" sizes="16x16"> + <link rel="apple-touch-icon" sizes="180x180" href="{{ "assets/icons/apple-touch-icon.png" | relativize_url }}"> + <link rel="icon" type="image/png" href="{{ "assets/icons/favicon-32x32.png" | relativize_url }}" sizes="32x32"> + <link rel="icon" type="image/png" href="{{ "assets/icons/favicon-16x16.png" | relativize_url }}" sizes="16x16"> </head> <body> <div class="wrapper"> @@ -63,6 +63,6 @@ <p>Noah.</p> </div> </div> - <script src="{{ relBase }}18/script.js"></script> + <script src="{{ "/18/script.js" | relativize_url }}"></script> </body> </html> 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 %} <head> <meta charset="utf-8"> <title>Noah Loomans</title> <meta name="theme-color" content="#ffffff"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <link rel="stylesheet" href="{{relBase}}style/main.css"> + <link rel="stylesheet" href="{{ "/style/main.css" | relativize_url }}"> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet"> <!-- sigh... favicon --> - <link rel="apple-touch-icon" sizes="180x180" href="{{relBase}}assets/icons/apple-touch-icon.png"> - <link rel="icon" type="image/png" href="{{relBase}}assets/icons/favicon-32x32.png" sizes="32x32"> - <link rel="icon" type="image/png" href="{{relBase}}assets/icons/favicon-16x16.png" sizes="16x16"> + <link rel="apple-touch-icon" sizes="180x180" href="{{ "/assets/icons/apple-touch-icon.png" | relativize_url }}"> + <link rel="icon" type="image/png" href="{{ "/assets/icons/favicon-32x32.png" | relativize_url }}" sizes="32x32"> + <link rel="icon" type="image/png" href="{{ "/assets/icons/favicon-16x16.png" | relativize_url }}" sizes="16x16"> {% if page.info %} <meta name="og:title" content="{{ page.info.title }}" /> 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 %} <header> <div class="logo-container"> - <a href="{{relBase}}"> - <img src="{{relBase}}assets/face.jpg" alt="Noah Loomans" class="logo"> + <a href="{{ "/" | relativize_url }}"> + <img src="{{ "/assets/face.jpg" | relativize_url }}" alt="Noah Loomans" class="logo"> </a> <div class="dotted-line"></div> </div> @@ -11,10 +10,10 @@ <div class="menu"> <ul class='no-markdown'> <li>const menu = [</li> - <li><a href="{{relBase}}">'Home'</a>,</li> - <li><a href="{{relBase}}projects/">'Projects'</a>,</li> - <li><a href="{{relBase}}random-projects/">'Random Projects'</a>,</li> - <li><a href="{{relBase}}badges/">'Badges'</a></li> + <li><a href="{{ "/" | relativize_url }}">'Home'</a>,</li> + <li><a href="{{ "/projects/" | relativize_url }}">'Projects'</a>,</li> + <li><a href="{{ "/random-projects/" | relativize_url }}">'Random Projects'</a>,</li> + <li><a href="{{ "/badges/" | relativize_url }}">'Badges'</a></li> <li>]</li> </ul></div> </div> 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 %} <!DOCTYPE html> <html> {% include head.html %} @@ -8,11 +7,11 @@ {% if page.branding == true %} <div class="random-project__header"> <div class="logo"> - <img src="{{relBase}}assets/face.jpg" alt="Noah Loomans" class="logo"> + <img src="{{ "assets/face.jpg" | relativize_url }}" alt="Noah Loomans" class="logo"> </div> <div class="text">Random Project</div> <div class="grow"></div> - <a href="/">Go to main site</a> + <a href="{{ "/" | relativize_url }}">Go to main site</a> </div> {% 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 @@ <!DOCTYPE html> -{% include relBase.html %} <html> <head> <meta charset="utf-8"> <title>{{ page.title }}</title> - <link rel="stylesheet" href="{{relBase}}slides/reveal.js/reveal.css"> + <link rel="stylesheet" href="{{ "/slides/reveal.js/reveal.css" | relativize_url }}"> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet"> {% for style in page.styles %} <link rel="stylesheet" href="{{ style }}"> @@ -12,7 +11,7 @@ </head> <body> {{ content }} - <script src="{{relBase}}slides/reveal.js/reveal.js"></script> + <script src="{{ "/slides/reveal.js/reveal.js" | relativize_url }}"></script> {% for script in page.scripts %} <script src="{{ script }}"></script> {% 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: <div class="projects"> <a class="project" href="http://rooster.hetmml.nl" target="_black" rel="noopener"> - <img src="/assets/projects/rooster.hetmml.nl.png" alt="rooster.hetmml.nl homepage"> + <img src="{{ "/assets/projects/rooster.hetmml.nl.png" | relativize_url }}" alt="rooster.hetmml.nl homepage"> <header>Metis Rooster</header> </a> <a class="project" href="http://managerzonderstress.nl" target="_black" rel="noopener"> - <img src="/assets/projects/managerzonderstress.nl.png" alt="managerzonderstress.nl homepage"> + <img src="{{ "/assets/projects/managerzonderstress.nl.png" | relativize_url }}" alt="managerzonderstress.nl homepage"> <header>Manager zonder stress</header> </a> </div> 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). |