0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-09 05:02:42 +00:00

Merge pull request #2527 from Gazook89/OG-Meta-tag-fix

Fix og:image and og:site_name
This commit is contained in:
Trevor Buckner
2022-12-01 12:49:36 -05:00
committed by GitHub

View File

@@ -78,10 +78,10 @@ const faqText = require('fs').readFileSync('faq.md', 'utf8');
String.prototype.replaceAll = function(s, r){return this.split(s).join(r);}; String.prototype.replaceAll = function(s, r){return this.split(s).join(r);};
const defaultMetaTags = { const defaultMetaTags = {
siteName : 'The Homebrewery - Make your Homebrew content look legit!', site_name : 'The Homebrewery - Make your Homebrew content look legit!',
title : 'The Homebrewery', title : 'The Homebrewery',
description : 'A NaturalCrit Tool for Homebrews', description : 'A NaturalCrit Tool for creating authentic Homebrews using Markdown.',
thumbnail : `${config.get('publicUrl')}/thumbnail.png`, image : `${config.get('publicUrl')}/thumbnail.png`,
type : 'website' type : 'website'
}; };
@@ -148,8 +148,7 @@ app.get('/changelog', async (req, res, next)=>{
req.ogMeta = { ...defaultMetaTags, req.ogMeta = { ...defaultMetaTags,
title : 'Changelog', title : 'Changelog',
description : 'Development changelog.', description : 'Development changelog.'
thumbnail : null
}; };
splitTextStyleAndMetadata(req.brew); splitTextStyleAndMetadata(req.brew);
@@ -208,8 +207,7 @@ app.get('/user/:username', async (req, res, next)=>{
req.ogMeta = { ...defaultMetaTags, req.ogMeta = { ...defaultMetaTags,
title : `${req.params.username}'s Collection`, title : `${req.params.username}'s Collection`,
description : 'View my collection of homebrew on the Homebrewery.', description : 'View my collection of homebrew on the Homebrewery.'
image : null
// type : could be 'profile'? // type : could be 'profile'?
}; };
@@ -274,7 +272,8 @@ app.get('/edit/:id', asyncHandler(getBrew('edit')), (req, res, next)=>{
req.ogMeta = { ...defaultMetaTags, req.ogMeta = { ...defaultMetaTags,
title : req.brew.title || 'Untitled Brew', title : req.brew.title || 'Untitled Brew',
description : req.brew.description || 'No description.', description : req.brew.description || 'No description.',
image : req.brew.thumbnail || null, image : req.brew.thumbnail || defaultMetaTags.image,
type : 'article' type : 'article'
}; };
@@ -292,8 +291,7 @@ app.get('/new/:id', asyncHandler(getBrew('share')), (req, res, next)=>{
req.ogMeta = { ...defaultMetaTags, req.ogMeta = { ...defaultMetaTags,
title : 'New', title : 'New',
description : 'Start crafting your homebrew on the Homebrewery!', description : 'Start crafting your homebrew on the Homebrewery!'
image : null
}; };
return next(); return next();
@@ -306,7 +304,7 @@ app.get('/share/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, r
req.ogMeta = { ...defaultMetaTags, req.ogMeta = { ...defaultMetaTags,
title : req.brew.title || 'Untitled Brew', title : req.brew.title || 'Untitled Brew',
description : req.brew.description || 'No description.', description : req.brew.description || 'No description.',
image : req.brew.thumbnail || null, image : req.brew.thumbnail || defaultMetaTags.image,
type : 'article' type : 'article'
}; };
@@ -377,8 +375,7 @@ app.get('/account', asyncHandler(async (req, res, next)=>{
req.ogMeta = { ...defaultMetaTags, req.ogMeta = { ...defaultMetaTags,
title : `Account Page`, title : `Account Page`,
description : null, description : null
image : null
}; };
return next(); return next();