Set canonical link to original video/playlist url
The local URL was used instead of the original url Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
2805cb7cb6
commit
106fa2249d
|
@ -36,6 +36,7 @@ type Tags = {
|
||||||
siteName: string
|
siteName: string
|
||||||
title: string
|
title: string
|
||||||
url: string
|
url: string
|
||||||
|
originUrl: string
|
||||||
description: string
|
description: string
|
||||||
|
|
||||||
embed?: {
|
embed?: {
|
||||||
|
@ -95,6 +96,7 @@ export class ClientHtml {
|
||||||
customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(video.description))
|
customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(video.description))
|
||||||
|
|
||||||
const url = WEBSERVER.URL + video.getWatchStaticPath()
|
const url = WEBSERVER.URL + video.getWatchStaticPath()
|
||||||
|
const originUrl = video.url
|
||||||
const title = escapeHTML(video.name)
|
const title = escapeHTML(video.name)
|
||||||
const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
|
const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
|
||||||
const description = escapeHTML(video.description)
|
const description = escapeHTML(video.description)
|
||||||
|
@ -114,7 +116,9 @@ export class ClientHtml {
|
||||||
const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary_large_image'
|
const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary_large_image'
|
||||||
const schemaType = 'VideoObject'
|
const schemaType = 'VideoObject'
|
||||||
|
|
||||||
customHtml = ClientHtml.addTags(customHtml, { url, siteName, title, description, image, embed, ogType, twitterCard, schemaType })
|
customHtml = ClientHtml.addTags(customHtml, {
|
||||||
|
url, originUrl, siteName, title, description, image, embed, ogType, twitterCard, schemaType
|
||||||
|
})
|
||||||
|
|
||||||
return customHtml
|
return customHtml
|
||||||
}
|
}
|
||||||
|
@ -141,6 +145,7 @@ export class ClientHtml {
|
||||||
customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(videoPlaylist.description))
|
customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(videoPlaylist.description))
|
||||||
|
|
||||||
const url = videoPlaylist.getWatchUrl()
|
const url = videoPlaylist.getWatchUrl()
|
||||||
|
const originUrl = videoPlaylist.url
|
||||||
const title = escapeHTML(videoPlaylist.name)
|
const title = escapeHTML(videoPlaylist.name)
|
||||||
const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
|
const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
|
||||||
const description = escapeHTML(videoPlaylist.description)
|
const description = escapeHTML(videoPlaylist.description)
|
||||||
|
@ -162,7 +167,9 @@ export class ClientHtml {
|
||||||
const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary'
|
const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary'
|
||||||
const schemaType = 'ItemList'
|
const schemaType = 'ItemList'
|
||||||
|
|
||||||
customHtml = ClientHtml.addTags(customHtml, { url, siteName, embed, title, description, image, list, ogType, twitterCard, schemaType })
|
customHtml = ClientHtml.addTags(customHtml, {
|
||||||
|
url, originUrl, siteName, embed, title, description, image, list, ogType, twitterCard, schemaType
|
||||||
|
})
|
||||||
|
|
||||||
return customHtml
|
return customHtml
|
||||||
}
|
}
|
||||||
|
@ -210,6 +217,7 @@ export class ClientHtml {
|
||||||
customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(entity.description))
|
customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(entity.description))
|
||||||
|
|
||||||
const url = entity.Actor.url
|
const url = entity.Actor.url
|
||||||
|
const originUrl = entity.Actor.url
|
||||||
const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
|
const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
|
||||||
const title = escapeHTML(entity.getDisplayName())
|
const title = escapeHTML(entity.getDisplayName())
|
||||||
const description = escapeHTML(entity.description)
|
const description = escapeHTML(entity.description)
|
||||||
|
@ -224,7 +232,7 @@ export class ClientHtml {
|
||||||
const twitterCard = 'summary'
|
const twitterCard = 'summary'
|
||||||
const schemaType = 'ProfilePage'
|
const schemaType = 'ProfilePage'
|
||||||
|
|
||||||
customHtml = ClientHtml.addTags(customHtml, { url, title, siteName, description, image, ogType, twitterCard, schemaType })
|
customHtml = ClientHtml.addTags(customHtml, { url, originUrl, title, siteName, description, image, ogType, twitterCard, schemaType })
|
||||||
|
|
||||||
return customHtml
|
return customHtml
|
||||||
}
|
}
|
||||||
|
@ -417,7 +425,7 @@ export class ClientHtml {
|
||||||
const twitterCardMetaTags = this.generateTwitterCardMetaTags(tagsValues)
|
const twitterCardMetaTags = this.generateTwitterCardMetaTags(tagsValues)
|
||||||
const schemaTags = this.generateSchemaTags(tagsValues)
|
const schemaTags = this.generateSchemaTags(tagsValues)
|
||||||
|
|
||||||
const { url, title, embed } = tagsValues
|
const { url, title, embed, originUrl } = tagsValues
|
||||||
|
|
||||||
const oembedLinkTags: { type: string, href: string, title: string }[] = []
|
const oembedLinkTags: { type: string, href: string, title: string }[] = []
|
||||||
|
|
||||||
|
@ -463,7 +471,7 @@ export class ClientHtml {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SEO, use origin URL
|
// SEO, use origin URL
|
||||||
tagsString += `<link rel="canonical" href="${url}" />`
|
tagsString += `<link rel="canonical" href="${originUrl}" />`
|
||||||
|
|
||||||
return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.META_TAGS, tagsString)
|
return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.META_TAGS, tagsString)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue