Files
posthog.com/gatsby-browser.js
Eli Kinsey cacf3003c7 Make Q&A its own section on posthog.com (#3007)
* Make Q&A its own section on posthog.com

* red links

* add appears on

* facet filter
2022-02-22 11:08:19 -05:00

24 lines
775 B
JavaScript

/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/
import { initKea, wrapElement } from './kea'
import './src/styles/global.css'
initKea(false)
export const wrapRootElement = wrapElement
export const onRouteUpdate = ({ location, prevLocation }) => {
// This is checked and set on initial load in the body script set in gatsby-ssr.js
// Checking for prevLocation prevents this from happening twice
if (typeof window !== 'undefined' && prevLocation) {
var slug = location.pathname.substring(1)
var theme = /^handbook|^docs|^blog|^integrations|^product|^tutorials|^questions/.test(slug)
? window.__theme
: 'light'
document.body.className = theme
}
}