feat: allow to define format for page title

respect this config option also when generating static content.

closes #376
This commit is contained in:
Danny Koppenhagen
2023-06-19 14:44:28 +02:00
committed by Stefan Rotsch
parent 8876d3b1c7
commit 810db6aea6
8 changed files with 34 additions and 5 deletions

View File

@@ -26,6 +26,7 @@ const runCommand = (command: string) =>
shell: true,
env: {
REACT_APP_RADAR_NAME: "AOE Technology Radar",
REACT_APP_RADAR_TITLE_FORMAT: "%TECHNOLOGY_NAME% | %APP_TITLE%",
REACT_APP_BUILDHASH: randomBytes(10).toString("hex"),
GENERATE_SOURCEMAP: "false",
...process.env,

View File

@@ -9,7 +9,7 @@ import {
import { JSDOM } from "jsdom";
import XmlSitemap from "xml-sitemap";
import { publicUrl } from "../src/config";
import { publicUrl, setTitle } from "../src/config";
import { createRadar } from "./generateJson/radar";
// Do this as the first thing so that any code reading it knows the right env.
@@ -56,6 +56,10 @@ const createStaticFiles = async () => {
const document = dom.window.document;
const rootEl = document.getElementById("root");
document.title = 'test'
setTitle(document, item.title)
if (rootEl) {
const textNode = document.createElement("div");
const bodyFragment = JSDOM.fragment(item.body);