conditionally add metatags only if site title is odysee
This commit is contained in:
parent
304bb3a999
commit
42c319702a
3 changed files with 15 additions and 9 deletions
|
@ -62,10 +62,6 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<link rel="manifest" href="./public/pwa/manifest.json"/>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="./public/pwa/icon-180.png">
|
||||
<script src="./serviceWorker.js"></script>
|
||||
|
||||
<!-- VARIABLE_HEAD_BEGIN -->
|
||||
<!-- VARIABLE_HEAD_END -->
|
||||
</head>
|
||||
|
|
|
@ -78,8 +78,18 @@ function buildOgMetadata(overrideOptions = {}) {
|
|||
return head;
|
||||
}
|
||||
|
||||
function buildBasicOgMetadata() {
|
||||
const head = '<!-- VARIABLE_HEAD_BEGIN -->' + buildOgMetadata() + '<!-- VARIABLE_HEAD_END -->';
|
||||
function conditionallyAddPWA() {
|
||||
let head = '';
|
||||
if (SITE_TITLE === 'Odysee') {
|
||||
head += '<link rel="manifest" href="./public/pwa/manifest.json"/>'
|
||||
head += '<link rel="apple-touch-icon" sizes="180x180" href="./public/pwa/icon-180.png">'
|
||||
head += '<script src="./serviceWorker.js"></script>'
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
function buildBasicOgMetadataAndPWA() {
|
||||
const head = '<!-- VARIABLE_HEAD_BEGIN -->' + conditionallyAddPWA() + buildOgMetadata() + '<!-- VARIABLE_HEAD_END -->';
|
||||
return head;
|
||||
}
|
||||
|
||||
|
@ -306,4 +316,4 @@ async function getHtml(ctx) {
|
|||
return insertToHead(html, ogMetadata);
|
||||
}
|
||||
|
||||
module.exports = { insertToHead, buildBasicOgMetadata, getHtml };
|
||||
module.exports = { insertToHead, buildBasicOgMetadataAndPWA, getHtml };
|
||||
|
|
|
@ -8,7 +8,7 @@ const WriteFilePlugin = require('write-file-webpack-plugin');
|
|||
const { DefinePlugin, ProvidePlugin } = require('webpack');
|
||||
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
|
||||
const { getJsBundleId } = require('./bundle-id.js');
|
||||
const { insertToHead, buildBasicOgMetadata } = require('./src/html');
|
||||
const { insertToHead, buildBasicOgMetadataAndPWA } = require('./src/html');
|
||||
const { insertVariableXml, getOpenSearchXml } = require('./src/xml');
|
||||
|
||||
const CUSTOM_ROOT = path.resolve(__dirname, '../custom/');
|
||||
|
@ -27,7 +27,7 @@ const copyWebpackCommands = [
|
|||
to: `${DIST_ROOT}/index.html`,
|
||||
// add javascript script to index.html, generate/insert metatags
|
||||
transform(content, path) {
|
||||
return insertToHead(content.toString(), buildBasicOgMetadata());
|
||||
return insertToHead(content.toString(), buildBasicOgMetadataAndPWA());
|
||||
},
|
||||
force: true,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue