Skip to content

Commit

Permalink
Merge pull request #4851 from HSLdevcom/fix-dynamic-metadata
Browse files Browse the repository at this point in the history
fix: build metaData from a deep clone of the template
  • Loading branch information
optionsome authored Aug 23, 2023
2 parents 7085a3b + 6c19fa8 commit 3465def
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import cloneDeep from 'lodash/cloneDeep';
import defaultConfig from './configurations/config.default';
import configMerger from './util/configMerger';
import { boundWithMinimumAreaSimple } from './util/geo-utils';
Expand All @@ -8,6 +9,8 @@ const configs = {}; // cache merged configs for speed
const themeMap = {};
// Look up paths for various asset files
const appRoot = `${process.cwd()}/`;
// eslint-disable-next-line global-require
const metaDataTemplate = require('./ssrmeta.json');

if (defaultConfig.themeMap) {
Object.keys(defaultConfig.themeMap).forEach(theme => {
Expand Down Expand Up @@ -42,8 +45,8 @@ function addMetaData(config) {
}
}
// read metadata template and modify it to match image assets generated by favicons-webpack-plugin
// eslint-disable-next-line global-require, import/no-unresolved, no-param-reassign
config.metaData = require('./ssrmeta.json');
// eslint-disable-next-line no-param-reassign
config.metaData = cloneDeep(metaDataTemplate);
config.metaData.link.forEach(link => {
// eslint-disable-next-line no-param-reassign
link.href = link.href.replace('<themehash>', manifestName);
Expand Down

0 comments on commit 3465def

Please sign in to comment.