site/gatsby-ssr.js
2020-01-22 20:20:52 +03:00

37 lines
1.1 KiB
JavaScript

import React from "react";
export function onRenderBody(
{ setHeadComponents, setPostBodyComponents }
) {
setHeadComponents([
<script
key="head1"
type="text/javascript"
src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
/>,
<script
key="head2"
type="text/javascript"
stc="https://code.jquery.com/jquery-3.4.1.js"
/>,
<script
key="postbody1"
type="text/javascript"
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js"
/>,
<script
key="activePage"
dangerouslySetInnerHTML={{
__html: `
let curActive = [' ', ' ', ' '];
if (document.location.pathname === '/about'){curActive[0] = 'active';}
if (document.location.pathname === '/projects/physics' || document.location.pathname === '/projects/education' || document.location.pathname === '/projects/math' || document.location.pathname === '/projects/software'){curActive[1] = 'active';}
if (document.location.pathname === '/partners'){curActive[2] = 'active';}
`
}}
/>
]);
setPostBodyComponents([
]);
}