website: fix greenhouse page

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-11-21 13:37:52 +01:00
parent 426f0bc9dd
commit e80df03819
2 changed files with 15 additions and 46 deletions

View File

@ -164,33 +164,14 @@ module.exports = {
},
],
],
ssrTemplate: `<!DOCTYPE html>
<html <%~ it.htmlAttributes %>>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0.86, maximum-scale=3.0, minimum-scale=0.86">
<meta name="generator" content="Docusaurus v<%= it.version %>">
<script async defer data-domain="goauthentik.io" src="https://goauthentik.io/js/script.js"></script>
<%~ it.headTags %>
<% it.metaAttributes.forEach((metaAttribute) => { %>
<%~ metaAttribute %>
<% }); %>
<% it.stylesheets.forEach((stylesheet) => { %>
<link rel="stylesheet" href="<%= it.baseUrl %><%= stylesheet %>" />
<% }); %>
<% it.scripts.forEach((script) => { %>
<link rel="preload" href="<%= it.baseUrl %><%= script %>" as="script">
<% }); %>
</head>
<body <%~ it.bodyAttributes %> itemscope="" itemtype="http://schema.org/Organization">
<%~ it.preBodyTags %>
<div id="__docusaurus">
<%~ it.appHtml %>
</div>
<% it.scripts.forEach((script) => { %>
<script src="<%= it.baseUrl %><%= script %>"></script>
<% }); %>
<%~ it.postBodyTags %>
</body>
</html>`,
scripts: [
{
src: "https://goauthentik.io/js/script.js",
async: true,
"data-domain": "goauthentik.io",
},
{
src: "https://boards.greenhouse.io/embed/job_board/js?for=authentiksecurity",
},
],
};

View File

@ -1,21 +1,9 @@
import React from "react";
import Layout from "@theme/Layout";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import { useEffect } from "react";
import { useColorMode } from "@docusaurus/theme-common";
const useScript = (url, selector = "body", async = true) => {
useEffect(() => {
const element = document.querySelector(selector);
const script = document.createElement("script");
script.src = url;
script.async = async;
element.appendChild(script);
return () => {
element.removeChild(script);
};
}, [url]);
};
import BrowserOnly from "@docusaurus/core/lib/client/exports/BrowserOnly";
import { useEffect } from "react";
function JobBoardWrapper() {
const context = useDocusaurusContext();
@ -28,13 +16,13 @@ function JobBoardWrapper() {
}
function JobBoard() {
useScript(
"https://boards.greenhouse.io/embed/job_board/js?for=authentiksecurity"
);
const { colorMode, setColorMode } = useColorMode();
if (colorMode !== "light") {
setColorMode("light");
}
useEffect(() => {
Grnhse.Iframe.load();
}, []);
return <div id="grnhse_app"></div>;
}