From f192f9a23df34d30e223e20ab5e8cb8210a7dfe9 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 0227fde..a6725b7 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 0000000..ff4e8b3 --- /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 37f0db4..32f019f 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) {