diff --git a/src/controllers/categories.js b/src/controllers/categories.js index 350fdd245f..25461205bc 100644 --- a/src/controllers/categories.js +++ b/src/controllers/categories.js @@ -13,9 +13,6 @@ categoriesController.list = function (req, res, next) { res.locals.metaTags = [{ name: 'title', content: String(meta.config.title || 'NodeBB'), - }, { - property: 'og:title', - content: '[[pages:categories]]', }, { property: 'og:type', content: 'website', @@ -42,6 +39,10 @@ categoriesController.list = function (req, res, next) { if (req.originalUrl.startsWith(nconf.get('relative_path') + '/api/categories') || req.originalUrl.startsWith(nconf.get('relative_path') + '/categories')) { data.breadcrumbs = helpers.buildBreadcrumbs([{ text: data.title }]); + res.locals.metaTags.push({ + property: 'og:title', + content: '[[pages:categories]]', + }); } data.categories.forEach(function (category) { diff --git a/src/meta/tags.js b/src/meta/tags.js index 79cb04cded..e5a6a10c9c 100644 --- a/src/meta/tags.js +++ b/src/meta/tags.js @@ -124,7 +124,7 @@ Tags.parse = function (req, data, meta, link, callback) { addIfNotExists(meta, 'property', 'og:title', Meta.config.title || 'NodeBB'); - var ogUrl = nconf.get('url') + req.path; + var ogUrl = nconf.get('url') + (req.originalUrl !== '/' ? req.originalUrl : ''); addIfNotExists(meta, 'property', 'og:url', ogUrl); addIfNotExists(meta, 'name', 'description', Meta.config.description);