From f192f9a23df34d30e223e20ab5e8cb8210a7dfe9 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Wed, 16 Feb 2022 04:03:02 +0000
Subject: [PATCH] fix #54: root all image urls
---
layouts/partials/popover.html | 3 ---
content/notes/hosting.md | 2 +-
layouts/_default/_markup/render-image.html | 8 ++++++++
3 files changed, 9 insertions(+), 4 deletions(-)
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 @@
### 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*
+*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 -}}
+<img src="{{ $src }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
+{{- else -}}
+{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
+<img src="{{ $fixedUrl }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
+{{- 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) {
--
Gitblit v1.10.0