Skip to content

Commit 5b7d972

Browse files
committed
chore: made Google console key optional
1 parent 84f8800 commit 5b7d972

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

compose/env.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ MB_DATA_DIRECTORY=""
112112
# Google Search Control
113113
# ---------------------------
114114

115-
GOOGLE_SEARCH_CONSOLE_KEY=...
115+
#GOOGLE_SEARCH_CONSOLE_KEY=""
116116

117117

118118
# ---------------------------
119119
# Distribution
120120
# ---------------------------
121121

122122
DISTRIBUTOR_TEXT="This website is hosted and distributed by ..."
123-
DISTRIBUTOR_URL="..."
123+
DISTRIBUTOR_URL="" # example.com/imprint

web-frontend/server.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const exportServiceUrlInternal =
2828
const distributorText =
2929
process.env.DISTRIBUTOR_TEXT ??
3030
'This website is hosted and distributed by ...';
31-
const distributorUrl = process.env.DISTRIBUTOR_URL ?? '...';
31+
const distributorUrl = process.env.DISTRIBUTOR_URL ?? '';
3232

3333
console.log('\n');
3434
console.log('isProduction', process.env.NODE_ENV === 'production');
@@ -284,14 +284,15 @@ baseRouter.use(/(.*)/, async (req: Request, res: Response) => {
284284
});
285285

286286
const noFollowLinksMeta = `<meta name="robots" content="nofollow"></meta>`;
287-
const googleSearchConsoleMeta = `<meta name="google-site-verification" content="${googleSearchConsoleKey}"></meta>`;
288287
rendered.head = rendered.head
289-
? rendered.head
290-
.concat('\n')
291-
.concat(noFollowLinksMeta)
292-
.concat('\n')
293-
.concat(googleSearchConsoleMeta)
294-
: noFollowLinksMeta.concat('\n').concat(googleSearchConsoleMeta);
288+
? rendered.head.concat('\n\t').concat(noFollowLinksMeta)
289+
: noFollowLinksMeta;
290+
if (googleSearchConsoleKey && googleSearchConsoleKey.trim().length > 0) {
291+
const googleSearchConsoleMeta = `<meta name="google-site-verification" content="${googleSearchConsoleKey}"></meta>`;
292+
rendered.head = rendered.head
293+
? rendered.head.concat('\n\t').concat(googleSearchConsoleMeta)
294+
: googleSearchConsoleMeta;
295+
}
295296

296297
const pageRoute = path.replace(baseUrl, '');
297298
if (
@@ -302,7 +303,7 @@ baseRouter.use(/(.*)/, async (req: Request, res: Response) => {
302303
if (metadata) {
303304
const metadataScript = `<script type="application/ld+json">${metadata}</script>`;
304305
rendered.head = rendered.head
305-
? rendered.head.concat('\n').concat(metadataScript)
306+
? rendered.head.concat('\n\t').concat(metadataScript)
306307
: metadataScript;
307308
}
308309
}

0 commit comments

Comments
 (0)