ActivityPub-federated video streaming platform using P2P directly in your web browser
Set canonical link to original video/playlist url
Thomas Citharel106fa2249de3
diff --git a/server/lib/client-html.ts b/server/lib/client-html.tsindex a1a4a53164..211ac3342a 100644--- a/server/lib/client-html.ts+++ b/server/lib/client-html.ts@@ -36,6 +36,7 @@ type Tags = {siteName: stringtitle: stringurl: string+ originUrl: stringdescription: stringembed?: {@@ -95,6 +96,7 @@ export class ClientHtml {customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(video.description))const url = WEBSERVER.URL + video.getWatchStaticPath()+ const originUrl = video.urlconst title = escapeHTML(video.name)const siteName = escapeHTML(CONFIG.INSTANCE.NAME)const description = escapeHTML(video.description)@@ -114,7 +116,9 @@ export class ClientHtml {const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary_large_image'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}@@ -141,6 +145,7 @@ export class ClientHtml {customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(videoPlaylist.description))const url = videoPlaylist.getWatchUrl()+ const originUrl = videoPlaylist.urlconst title = escapeHTML(videoPlaylist.name)const siteName = escapeHTML(CONFIG.INSTANCE.NAME)const description = escapeHTML(videoPlaylist.description)@@ -162,7 +167,9 @@ export class ClientHtml {const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary'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}@@ -210,6 +217,7 @@ export class ClientHtml {customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(entity.description))const url = entity.Actor.url+ const originUrl = entity.Actor.urlconst siteName = escapeHTML(CONFIG.INSTANCE.NAME)const title = escapeHTML(entity.getDisplayName())const description = escapeHTML(entity.description)@@ -224,7 +232,7 @@ export class ClientHtml {const twitterCard = 'summary'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}@@ -417,7 +425,7 @@ export class ClientHtml {const twitterCardMetaTags = this.generateTwitterCardMetaTags(tagsValues)const schemaTags = this.generateSchemaTags(tagsValues)- const { url, title, embed } = tagsValues+ const { url, title, embed, originUrl } = tagsValuesconst oembedLinkTags: { type: string, href: string, title: string }[] = []@@ -463,7 +471,7 @@ export class ClientHtml {}// 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)}