From 3fded1a4238a3eca06afbd03a9b41e7804407460 Mon Sep 17 00:00:00 2001 From: Riccardo Ferretti Date: Fri, 22 Jan 2021 12:56:36 +0100 Subject: [PATCH] added JS hack to convert wikilink to GH pages friendly url --- _layouts/home.html | 6 ++++++ _layouts/page.html | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/_layouts/home.html b/_layouts/home.html index 776484f..33d9afb 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -9,4 +9,10 @@ layout: default document.querySelectorAll(".markdown-body a[title]").forEach((a) => { a.innerText = a.title; }); + // Hack: Remove .md extension from wikilinks to get the html in jekyll + document.querySelectorAll("a").forEach(l => { + if (l.href.endsWith('.md')) { + l.href = l.href.substring(0, l.href.length-3) + } + }) diff --git a/_layouts/page.html b/_layouts/page.html index 776484f..33d9afb 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -9,4 +9,10 @@ layout: default document.querySelectorAll(".markdown-body a[title]").forEach((a) => { a.innerText = a.title; }); + // Hack: Remove .md extension from wikilinks to get the html in jekyll + document.querySelectorAll("a").forEach(l => { + if (l.href.endsWith('.md')) { + l.href = l.href.substring(0, l.href.length-3) + } + })