summaryrefslogtreecommitdiff
path: root/deps/npm/docs/src/components/scripts.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/docs/src/components/scripts.js')
-rw-r--r--deps/npm/docs/src/components/scripts.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/deps/npm/docs/src/components/scripts.js b/deps/npm/docs/src/components/scripts.js
index 54ad165400..75126e11ff 100644
--- a/deps/npm/docs/src/components/scripts.js
+++ b/deps/npm/docs/src/components/scripts.js
@@ -3,14 +3,18 @@ import React from 'react'
const IS_STATIC = process.env.GATSBY_IS_STATIC
const Scripts = () => {
+ // Workaround: Make links work on the static html site
if (IS_STATIC) {
return (
<script
dangerouslySetInnerHTML={{
__html: `
- // Workaround: Make links on our Markdown files work on the static site
- var anchors = document.querySelectorAll("#see-also + ul li a")
- Array.prototype.slice.call(anchors).map(function(el) { el.href = el + "/index.html" })
+ var anchors = document.querySelectorAll(".sidebar a, .documentation a")
+ Array.prototype.slice.call(anchors).map(function(el) {
+ if (el.href.match(/file:\\/\\//)) {
+ el.href = el.href + "/index.html"
+ }
+ })
`
}}
/>