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> scripts: [
<html <%~ it.htmlAttributes %>> {
<head> src: "https://goauthentik.io/js/script.js",
<meta charset="UTF-8"> async: true,
<meta name="viewport" content="width=device-width, initial-scale=0.86, maximum-scale=3.0, minimum-scale=0.86"> "data-domain": "goauthentik.io",
<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 %> src: "https://boards.greenhouse.io/embed/job_board/js?for=authentiksecurity",
<% 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>`,
}; };

View File

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