aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-05 13:29:10 +0200
committerChocobozzz <me@florianbigard.com>2021-08-05 13:29:55 +0200
commit352819ef921e45381b3fbb17072926103b320e73 (patch)
tree8278744f1e5b25fbd24a29e798fcca719d31bd96 /server/lib
parentda948b75ca7243d12de9e03822f1dc332de1a830 (diff)
downloadPeerTube-352819ef921e45381b3fbb17072926103b320e73.tar.gz
PeerTube-352819ef921e45381b3fbb17072926103b320e73.tar.zst
PeerTube-352819ef921e45381b3fbb17072926103b320e73.zip
Do not index remote actors
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/client-html.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts
index a557c090f..e093d35f7 100644
--- a/server/lib/client-html.ts
+++ b/server/lib/client-html.ts
@@ -44,6 +44,8 @@ type Tags = {
44 originUrl: string 44 originUrl: string
45 description: string 45 description: string
46 46
47 disallowIndexation?: boolean
48
47 embed?: { 49 embed?: {
48 url: string 50 url: string
49 createdAt: string 51 createdAt: string
@@ -285,7 +287,8 @@ class ClientHtml {
285 image, 287 image,
286 ogType, 288 ogType,
287 twitterCard, 289 twitterCard,
288 schemaType 290 schemaType,
291 disallowIndexation: !entity.Actor.isOwned()
289 }) 292 })
290 293
291 return customHtml 294 return customHtml
@@ -488,7 +491,7 @@ class ClientHtml {
488 const twitterCardMetaTags = this.generateTwitterCardMetaTags(tagsValues) 491 const twitterCardMetaTags = this.generateTwitterCardMetaTags(tagsValues)
489 const schemaTags = this.generateSchemaTags(tagsValues) 492 const schemaTags = this.generateSchemaTags(tagsValues)
490 493
491 const { url, title, embed, originUrl } = tagsValues 494 const { url, title, embed, originUrl, disallowIndexation } = tagsValues
492 495
493 const oembedLinkTags: { type: string, href: string, title: string }[] = [] 496 const oembedLinkTags: { type: string, href: string, title: string }[] = []
494 497
@@ -536,6 +539,10 @@ class ClientHtml {
536 // SEO, use origin URL 539 // SEO, use origin URL
537 tagsString += `<link rel="canonical" href="${originUrl}" />` 540 tagsString += `<link rel="canonical" href="${originUrl}" />`
538 541
542 if (disallowIndexation) {
543 tagsString += `<meta name="robots" content="noindex" />`
544 }
545
539 return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.META_TAGS, tagsString) 546 return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.META_TAGS, tagsString)
540 } 547 }
541} 548}