feat: dynamically fetch indices
This commit is contained in:
parent
4587b13360
commit
fcd5d2807d
10 changed files with 205 additions and 175 deletions
|
@ -1,5 +1,7 @@
|
|||
{{if $.Site.Data.config.enableLinkPreview}}
|
||||
<script>
|
||||
async function run() {
|
||||
const {content} = await fetchData()
|
||||
function htmlToElement(html) {
|
||||
const template = document.createElement('template')
|
||||
html = html.trim()
|
||||
|
@ -11,7 +13,6 @@
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
[...document.getElementsByClassName("internal-link")]
|
||||
.forEach(li => {
|
||||
console.log(li.dataset.src.replace(pathRegex, ''))
|
||||
const linkDest = content[li.dataset.src.replace(pathRegex, '')]
|
||||
if (linkDest) {
|
||||
const popoverElement = `<div class="popover">
|
||||
|
@ -29,5 +30,8 @@
|
|||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
run()
|
||||
</script>
|
||||
{{end}}
|
Loading…
Add table
Add a link
Reference in a new issue