mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-03-22 11:08:10 +00:00
bring back og meta tags
This commit is contained in:
@@ -11,7 +11,6 @@
|
|||||||
type="text/css" />
|
type="text/css" />
|
||||||
<link rel="icon" href="/assets/favicon.ico" type="image/x-icon" />
|
<link rel="icon" href="/assets/favicon.ico" type="image/x-icon" />
|
||||||
|
|
||||||
<!-- Optional: static OG defaults -->
|
|
||||||
<meta name="twitter:card" content="summary" />
|
<meta name="twitter:card" content="summary" />
|
||||||
<title>The Homebrewery - NaturalCrit</title>
|
<title>The Homebrewery - NaturalCrit</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -576,6 +576,15 @@ export default async function createApp(vite) {
|
|||||||
userThemes : req.userThemes
|
userThemes : req.userThemes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ogTags = [];
|
||||||
|
const ogMeta = req.ogMeta ?? {};
|
||||||
|
Object.entries(ogMeta).forEach(([key, value])=>{
|
||||||
|
if(!value) return;
|
||||||
|
const tag = `<meta property="og:${key}" content="${value}">`;
|
||||||
|
ogTags.push(tag);
|
||||||
|
});
|
||||||
|
const ogMetaTags = ogTags.join('\n');
|
||||||
|
|
||||||
const htmlPath = isProd ? path.resolve('build', 'index.html') : path.resolve('index.html');
|
const htmlPath = isProd ? path.resolve('build', 'index.html') : path.resolve('index.html');
|
||||||
let html = fs.readFileSync(htmlPath, 'utf-8');
|
let html = fs.readFileSync(htmlPath, 'utf-8');
|
||||||
|
|
||||||
@@ -585,7 +594,7 @@ export default async function createApp(vite) {
|
|||||||
|
|
||||||
html = html.replace(
|
html = html.replace(
|
||||||
'<head>',
|
'<head>',
|
||||||
`<head>\n<script id="props" >window.__INITIAL_PROPS__ = ${JSON.stringify(props)}</script>`
|
`<head>\n<script id="props" >window.__INITIAL_PROPS__ = ${JSON.stringify(props)}</script>\n${ogMetaTags}`
|
||||||
);
|
);
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
Reference in New Issue
Block a user