mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-10 12:52:39 +02:00
closes #1958
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
var tagsController = {},
|
||||
async = require('async'),
|
||||
nconf = require('nconf'),
|
||||
topics = require('./../topics');
|
||||
|
||||
tagsController.getTag = function(req, res, next) {
|
||||
@@ -22,6 +23,22 @@ tagsController.getTag = function(req, res, next) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
res.locals.metaTags = [
|
||||
{
|
||||
name: "title",
|
||||
content: tag
|
||||
},
|
||||
{
|
||||
property: 'og:title',
|
||||
content: tag
|
||||
},
|
||||
{
|
||||
property: "og:url",
|
||||
content: nconf.get('url') + '/tags/' + tag
|
||||
}
|
||||
];
|
||||
|
||||
data.tag = tag;
|
||||
res.render('tag', data);
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ module.exports = function(Meta) {
|
||||
var tests = {
|
||||
isCategory: /^category\/\d+\/?/,
|
||||
isTopic: /^topic\/\d+\/?/,
|
||||
isTag: /^tags\/[\s\S]+\/?/,
|
||||
isUserPage: /^user\/[^\/]+(\/[\w]+)?/
|
||||
};
|
||||
|
||||
@@ -25,6 +26,7 @@ module.exports = function(Meta) {
|
||||
};
|
||||
|
||||
Meta.title.parseFragment = function (urlFragment, language, callback) {
|
||||
console.log(urlFragment);
|
||||
var translated = ['', 'recent', 'unread', 'users', 'notifications'];
|
||||
if (translated.indexOf(urlFragment) !== -1) {
|
||||
if (!urlFragment.length) {
|
||||
@@ -42,6 +44,9 @@ module.exports = function(Meta) {
|
||||
var tid = urlFragment.match(/topic\/(\d+)/)[1];
|
||||
|
||||
require('../topics').getTopicField(tid, 'title', callback);
|
||||
} else if (tests.isTag.test(urlFragment)) {
|
||||
var tag = urlFragment.match(/tags\/([\s\S]+)/)[1];
|
||||
callback(null, tag);
|
||||
} else if (tests.isUserPage.test(urlFragment)) {
|
||||
var matches = urlFragment.match(/user\/([^\/]+)\/?([\w]+)?/),
|
||||
userslug = matches[1],
|
||||
|
||||
Reference in New Issue
Block a user