From fe3a75812fcb33cb3f20ae9029146fc67a1f7080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 27 Nov 2017 14:07:59 -0500 Subject: [PATCH] closes #6113 closes #6114 --- src/controllers/categories.js | 7 ++++--- src/meta/tags.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) 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);