aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/client-html.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/client-html.ts')
-rw-r--r--server/lib/client-html.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts
index 72194416d..e093d35f7 100644
--- a/server/lib/client-html.ts
+++ b/server/lib/client-html.ts
@@ -5,7 +5,7 @@ import validator from 'validator'
5import { escapeHTML } from '@shared/core-utils/renderer' 5import { escapeHTML } from '@shared/core-utils/renderer'
6import { HTMLServerConfig } from '@shared/models' 6import { HTMLServerConfig } from '@shared/models'
7import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n' 7import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n'
8import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes' 8import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
9import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos' 9import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos'
10import { isTestInstance, sha256 } from '../helpers/core-utils' 10import { isTestInstance, sha256 } from '../helpers/core-utils'
11import { logger } from '../helpers/logger' 11import { logger } from '../helpers/logger'
@@ -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
@@ -162,7 +164,7 @@ class ClientHtml {
162 let customHtml = ClientHtml.addTitleTag(html, escapeHTML(videoPlaylist.name)) 164 let customHtml = ClientHtml.addTitleTag(html, escapeHTML(videoPlaylist.name))
163 customHtml = ClientHtml.addDescriptionTag(customHtml, mdToPlainText(videoPlaylist.description)) 165 customHtml = ClientHtml.addDescriptionTag(customHtml, mdToPlainText(videoPlaylist.description))
164 166
165 const url = videoPlaylist.getWatchUrl() 167 const url = WEBSERVER.URL + videoPlaylist.getWatchStaticPath()
166 const originUrl = videoPlaylist.url 168 const originUrl = videoPlaylist.url
167 const title = escapeHTML(videoPlaylist.name) 169 const title = escapeHTML(videoPlaylist.name)
168 const siteName = escapeHTML(CONFIG.INSTANCE.NAME) 170 const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
@@ -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}