0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 17:32:38 +00:00

move metaTag objects to app.js

This commit is contained in:
Gazook89
2022-11-05 23:32:30 -05:00
parent 4e26bb309c
commit 672d582caf
2 changed files with 110 additions and 36 deletions

View File

@@ -1,42 +1,42 @@
const template = async function(name, title='', props = {}){
const HOMEBREWERY_PUBLIC_URL=props.config.publicUrl;
// const HOMEBREWERY_PUBLIC_URL=props.config.publicUrl;
const ogMeta = {
siteName : 'The Homebrewery - Make your Homebrew content look legit!',
title : 'The Homebrewery',
description : 'Homepage',
thumbnail : `${HOMEBREWERY_PUBLIC_URL}/thumbnail.png`,
type : 'website'
};
// const ogMeta = {
// siteName : 'The Homebrewery - Make your Homebrew content look legit!',
// title : 'The Homebrewery',
// description : 'Homepage',
// thumbnail : `${HOMEBREWERY_PUBLIC_URL}/thumbnail.png`,
// type : 'website'
// };
if(props.url.match(/\/share\/|\/edit\//)){
Object.assign(ogMeta, {
siteName : null,
title : props.brew.title || 'Homebrewery - Untitled Brew',
description : props.brew.description || 'No description.',
image : props.brew.thumbnail || null,
type : 'article'
});
} else if(props.url.match(/\/print\/|\/source\//)){
Object.assign(ogMeta, {
siteName : null,
title : props.brew.title ? `${props.brew.title} - ${props.url.match(/\/print\/|\/source\//)}` : 'Homebrewery - Untitled Brew',
description : props.brew.description || 'No description.',
image : props.brew.thumbnail || null,
type : 'article'
});
} else if(props.url.match(/\/user\//)){
Object.assign(ogMeta, {
siteName : null,
title : `${props.username} - The Homebrewery`,
description : `${props.username}'s user page.`,
image : null,
type : 'profile'
});
}
// if(props.url.match(/\/share\/|\/edit\//)){
// Object.assign(ogMeta, {
// siteName : null,
// title : props.brew.title || 'Homebrewery - Untitled Brew',
// description : props.brew.description || 'No description.',
// image : props.brew.thumbnail || null,
// type : 'article'
// });
// } else if(props.url.match(/\/print\/|\/source\//)){
// Object.assign(ogMeta, {
// siteName : null,
// title : props.brew.title ? `${props.brew.title} - ${props.url.match(/\/print\/|\/source\//)}` : 'Homebrewery - Untitled Brew',
// description : props.brew.description || 'No description.',
// image : props.brew.thumbnail || null,
// type : 'article'
// });
// } else if(props.url.match(/\/user\//)){
// Object.assign(ogMeta, {
// siteName : null,
// title : `${props.username} - The Homebrewery`,
// description : `${props.username}'s user page.`,
// image : null,
// type : 'profile'
// });
// }
const ogTags = [];
Object.entries(ogMeta).forEach(([key, value])=>{
Object.entries(props.ogMeta).forEach(([key, value])=>{
if(!value) return;
const tag = `<meta property="og:${key}" content="${value}">`;
ogTags.push(tag);