From d46e22383133b944201bf5cdf85d44c48c891d07 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 10 Jan 2022 16:51:00 +0000
Subject: [PATCH] revert baseurl fix
---
layouts/partials/popover.html | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/layouts/partials/popover.html b/layouts/partials/popover.html
index d9cc941..951f135 100644
--- a/layouts/partials/popover.html
+++ b/layouts/partials/popover.html
@@ -1,3 +1,4 @@
+{{if $.Site.Data.config.enableLinkPreview}}
<script>
function htmlToElement(html) {
const template = document.createElement('template')
@@ -6,10 +7,11 @@
return template.content.firstChild
}
+ const pathRegex = /\.\.(\/\.\.)*/
document.addEventListener("DOMContentLoaded", () => {
[...document.getElementsByClassName("internal-link")]
.forEach(li => {
- const linkDest = content[li.dataset.src]
+ const linkDest = content[li.dataset.src.replace(pathRegex, '')]
if (linkDest) {
const popoverElement = `<div class="popover">
<h3>${linkDest.title}</h3>
@@ -26,4 +28,5 @@
}
})
})
-</script>
\ No newline at end of file
+</script>
+{{end}}
\ No newline at end of file
--
Gitblit v1.10.0