mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: duplicate canonical link header
This commit is contained in:
@@ -167,10 +167,17 @@ function addTags(res, userData) {
|
|||||||
|
|
||||||
res.locals.linkTags = [];
|
res.locals.linkTags = [];
|
||||||
|
|
||||||
|
if (utils.isNumber(userData.uid)) {
|
||||||
res.locals.linkTags.push({
|
res.locals.linkTags.push({
|
||||||
rel: 'canonical',
|
rel: 'canonical',
|
||||||
href: `${url}/user/${userData.userslug}`,
|
href: `${url}/user/${userData.userslug}`,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
res.locals.linkTags.push({
|
||||||
|
rel: 'canonical',
|
||||||
|
href: userData.url || userData.uid,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (meta.config.activitypubEnabled) {
|
if (meta.config.activitypubEnabled) {
|
||||||
res.locals.linkTags.push({
|
res.locals.linkTags.push({
|
||||||
@@ -178,12 +185,5 @@ function addTags(res, userData) {
|
|||||||
type: 'application/activity+json',
|
type: 'application/activity+json',
|
||||||
href: `${nconf.get('url')}/uid/${userData.uid}`,
|
href: `${nconf.get('url')}/uid/${userData.uid}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!utils.isNumber(userData.uid)) {
|
|
||||||
res.locals.linkTags.push({
|
|
||||||
rel: 'canonical',
|
|
||||||
href: userData.url || userData.uid,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user