-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added JavaScript written by @NieDzejkob from Zola issue getzola/zola/issues/1285 * Changed styling for footnotes * Updated index template to include site.js
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This adds links back to where a footnote is originally referenced. | ||
const addBackLinks = () => { | ||
for (const ref of document.getElementsByClassName('footnote-reference')) { | ||
const hash = ref.children[0].hash.substring(1); | ||
const refhash = 'ref:' + hash; | ||
ref.id = refhash; | ||
} | ||
|
||
for (const footnote of document.getElementsByClassName('footnote-definition')) { | ||
const hash = footnote.id; | ||
const refhash = 'ref:' + hash; | ||
const backlink = document.createElement('a'); | ||
|
||
backlink.href = '#' + refhash; | ||
backlink.className = 'footnote-backlink'; | ||
backlink.innerText = '^'; | ||
|
||
sup = footnote.children[0]; | ||
sup.appendChild(backlink); | ||
} | ||
} | ||
|
||
window.addEventListener('load', addBackLinks); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters