mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[scripts] fix anchor links not working
This commit is contained in:
parent
3a02a30ef3
commit
d67637769d
1 changed files with 13 additions and 0 deletions
|
@ -141,6 +141,19 @@ rendered_html = """\
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="footer" role="contentinfo"></div>
|
<div id="footer" role="contentinfo"></div>
|
||||||
|
|
||||||
|
<script>(function(){{
|
||||||
|
var anchorHrefPrefix = window.location.href.replace(/#.+$/, "")
|
||||||
|
|
||||||
|
var links = document.getElementsByTagName("a")
|
||||||
|
for (var i = 0, len = links.length; i < len; i++) {{
|
||||||
|
var link = links[i]
|
||||||
|
var href = link.getAttribute("href")
|
||||||
|
if (typeof href === "string" && href[0] === "#") {{
|
||||||
|
link.setAttribute("href", anchorHrefPrefix + href)
|
||||||
|
}}
|
||||||
|
}}
|
||||||
|
}}())</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue