]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/client-html.ts
Use postgres 10 for tests
[github/Chocobozzz/PeerTube.git] / server / lib / client-html.ts
index ae335240e96b9da1141f2a9ff34e9a5ed23c5e06..e093d35f733540a4cd2d1e13e53bf62415e7e4e8 100644 (file)
@@ -44,6 +44,8 @@ type Tags = {
   originUrl: string
   description: string
 
+  disallowIndexation?: boolean
+
   embed?: {
     url: string
     createdAt: string
@@ -162,7 +164,7 @@ class ClientHtml {
     let customHtml = ClientHtml.addTitleTag(html, escapeHTML(videoPlaylist.name))
     customHtml = ClientHtml.addDescriptionTag(customHtml, mdToPlainText(videoPlaylist.description))
 
-    const url = videoPlaylist.getWatchStaticPath()
+    const url = WEBSERVER.URL + videoPlaylist.getWatchStaticPath()
     const originUrl = videoPlaylist.url
     const title = escapeHTML(videoPlaylist.name)
     const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
@@ -285,7 +287,8 @@ class ClientHtml {
       image,
       ogType,
       twitterCard,
-      schemaType
+      schemaType,
+      disallowIndexation: !entity.Actor.isOwned()
     })
 
     return customHtml
@@ -488,7 +491,7 @@ class ClientHtml {
     const twitterCardMetaTags = this.generateTwitterCardMetaTags(tagsValues)
     const schemaTags = this.generateSchemaTags(tagsValues)
 
-    const { url, title, embed, originUrl } = tagsValues
+    const { url, title, embed, originUrl, disallowIndexation } = tagsValues
 
     const oembedLinkTags: { type: string, href: string, title: string }[] = []
 
@@ -536,6 +539,10 @@ class ClientHtml {
     // SEO, use origin URL
     tagsString += `<link rel="canonical" href="${originUrl}" />`
 
+    if (disallowIndexation) {
+      tagsString += `<meta name="robots" content="noindex" />`
+    }
+
     return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.META_TAGS, tagsString)
   }
 }