Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > 3838a972c94b8bbe6fb04220e63b7ff2 > files > 497

nodejs-docs-10.22.1-9.mga7.noarch.rpm

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: `
          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"
            }
          })
          `
        }}
      />
    )
  }

  return null
}

export default Scripts