More flexible way to forbid indexation
This commit is contained in:
parent
272a902b2a
commit
58daa2d97b
1 changed files with 17 additions and 6 deletions
|
@ -47,7 +47,7 @@ type Tags = {
|
||||||
url: string
|
url: string
|
||||||
originUrl: string
|
originUrl: string
|
||||||
|
|
||||||
disallowIndexation?: boolean
|
indexationPolicy: 'always' | 'never'
|
||||||
|
|
||||||
embed?: {
|
embed?: {
|
||||||
url: string
|
url: string
|
||||||
|
@ -139,7 +139,11 @@ class ClientHtml {
|
||||||
escapedSiteName: escapeHTML(siteName),
|
escapedSiteName: escapeHTML(siteName),
|
||||||
escapedTitle: escapeHTML(title),
|
escapedTitle: escapeHTML(title),
|
||||||
escapedTruncatedDescription,
|
escapedTruncatedDescription,
|
||||||
disallowIndexation: video.privacy !== VideoPrivacy.PUBLIC,
|
|
||||||
|
indexationPolicy: video.privacy !== VideoPrivacy.PUBLIC
|
||||||
|
? 'never'
|
||||||
|
: 'always',
|
||||||
|
|
||||||
image,
|
image,
|
||||||
embed,
|
embed,
|
||||||
ogType,
|
ogType,
|
||||||
|
@ -203,7 +207,11 @@ class ClientHtml {
|
||||||
escapedSiteName: escapeHTML(siteName),
|
escapedSiteName: escapeHTML(siteName),
|
||||||
escapedTitle: escapeHTML(title),
|
escapedTitle: escapeHTML(title),
|
||||||
escapedTruncatedDescription,
|
escapedTruncatedDescription,
|
||||||
disallowIndexation: videoPlaylist.privacy !== VideoPlaylistPrivacy.PUBLIC,
|
|
||||||
|
indexationPolicy: videoPlaylist.privacy !== VideoPlaylistPrivacy.PUBLIC
|
||||||
|
? 'never'
|
||||||
|
: 'always',
|
||||||
|
|
||||||
embed,
|
embed,
|
||||||
image,
|
image,
|
||||||
list,
|
list,
|
||||||
|
@ -304,7 +312,10 @@ class ClientHtml {
|
||||||
ogType,
|
ogType,
|
||||||
twitterCard,
|
twitterCard,
|
||||||
schemaType,
|
schemaType,
|
||||||
disallowIndexation: !entity.Actor.isOwned()
|
|
||||||
|
indexationPolicy: entity.Actor.isOwned()
|
||||||
|
? 'always'
|
||||||
|
: 'never'
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
return customHtml
|
return customHtml
|
||||||
|
@ -520,7 +531,7 @@ class ClientHtml {
|
||||||
const twitterCardMetaTags = this.generateTwitterCardMetaTags(tagsValues)
|
const twitterCardMetaTags = this.generateTwitterCardMetaTags(tagsValues)
|
||||||
const schemaTags = await this.generateSchemaTags(tagsValues, context)
|
const schemaTags = await this.generateSchemaTags(tagsValues, context)
|
||||||
|
|
||||||
const { url, escapedTitle, embed, originUrl, disallowIndexation } = tagsValues
|
const { url, escapedTitle, embed, originUrl, indexationPolicy } = tagsValues
|
||||||
|
|
||||||
const oembedLinkTags: { type: string, href: string, escapedTitle: string }[] = []
|
const oembedLinkTags: { type: string, href: string, escapedTitle: string }[] = []
|
||||||
|
|
||||||
|
@ -568,7 +579,7 @@ class ClientHtml {
|
||||||
// SEO, use origin URL
|
// SEO, use origin URL
|
||||||
tagsStr += `<link rel="canonical" href="${originUrl}" />`
|
tagsStr += `<link rel="canonical" href="${originUrl}" />`
|
||||||
|
|
||||||
if (disallowIndexation) {
|
if (indexationPolicy === 'never') {
|
||||||
tagsStr += `<meta name="robots" content="noindex" />`
|
tagsStr += `<meta name="robots" content="noindex" />`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue