From ce4c95b8ab1ce978e2e92c4c40f30f7418c26650 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Tue, 15 Feb 2022 23:03:02 -0500 Subject: [PATCH] fix #54: root all image urls --- content/notes/hosting.md | 2 +- layouts/_default/_markup/render-image.html | 8 ++++++++ layouts/partials/popover.html | 3 --- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 layouts/_default/_markup/render-image.html diff --git a/content/notes/hosting.md b/content/notes/hosting.md index 0227fde0..a6725b72 100644 --- a/content/notes/hosting.md +++ b/content/notes/hosting.md @@ -10,7 +10,7 @@ Quartz is designed to be effortless to deploy. If you forked and cloned Quartz d ### Enable GitHub Actions By default, GitHub disables workflows from running automatically on Forked Repostories. Head to the 'Actions' tab of your forked repository and Enable Workflows to setup deploying your Quartz site! -![Enable GitHub Actions](/notes/images/github-actions.png)*Enable GitHub Actions* +![Enable GitHub Actions](notes/images/github-actions.png)*Enable GitHub Actions* ### Enable GitHub Pages diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 00000000..ff4e8b39 --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,8 @@ +{{$src := .Destination | safeURL }} +{{$external := strings.HasPrefix $src "http" }} +{{- if $external -}} +{{ .Text }} +{{- else -}} +{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}} +{{ .Text }} +{{- end -}} diff --git a/layouts/partials/popover.html b/layouts/partials/popover.html index 37f0db48..32f019ff 100644 --- a/layouts/partials/popover.html +++ b/layouts/partials/popover.html @@ -11,9 +11,6 @@ fetchData().then(({content}) => { const links = [...document.getElementsByClassName("internal-link")] links.forEach(li => { - console.log(li.dataset.src.replace(baseUrl, "")) - console.log(content[li.dataset.src.replace(baseUrl, "")]) - console.log(content) const linkDest = content[li.dataset.src.replace(baseUrl, "")] // const linkDest = content[li.dataset.src] if (linkDest) {