mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add embedUrl to video structured data
This commit is contained in:
parent
e4f0e1c8f4
commit
392e58a4c7
1 changed files with 10 additions and 4 deletions
|
|
@ -104,6 +104,11 @@ function buildVideoStructuredData ( video, featuredApps ) {
|
||||||
|
|
||||||
const featuredAppsString = makeFeaturedAppsString( featuredApps )
|
const featuredAppsString = makeFeaturedAppsString( featuredApps )
|
||||||
|
|
||||||
|
const embedUrl = new URL( `${ this.$config.siteUrl }/embed/rich-results-player` )
|
||||||
|
|
||||||
|
embedUrl.searchParams.append( 'youtube-id', video.id )
|
||||||
|
embedUrl.searchParams.append( 'name', video.name )
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
// https://developers.google.com/search/docs/data-types/video
|
// https://developers.google.com/search/docs/data-types/video
|
||||||
|
|
@ -116,7 +121,7 @@ function buildVideoStructuredData ( video, featuredApps ) {
|
||||||
"uploadDate": video.lastUpdated.raw,
|
"uploadDate": video.lastUpdated.raw,
|
||||||
// "duration": "PT1M54S", // Need to updaet Youtube API Request for this
|
// "duration": "PT1M54S", // Need to updaet Youtube API Request for this
|
||||||
// "contentUrl": "https://www.example.com/video/123/file.mp4",
|
// "contentUrl": "https://www.example.com/video/123/file.mp4",
|
||||||
// "embedUrl": "https://www.example.com/embed/123",
|
"embedUrl": embedUrl.href,
|
||||||
// "interactionStatistic": {
|
// "interactionStatistic": {
|
||||||
// "@type": "InteractionCounter",
|
// "@type": "InteractionCounter",
|
||||||
// "interactionType": { "@type": "http://schema.org/WatchAction" },
|
// "interactionType": { "@type": "http://schema.org/WatchAction" },
|
||||||
|
|
@ -145,8 +150,6 @@ export default {
|
||||||
payload
|
payload
|
||||||
} = data
|
} = data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Manually get payload as fallback
|
// Manually get payload as fallback
|
||||||
// Uncomment for dev
|
// Uncomment for dev
|
||||||
// if ( payload === undefined ) {
|
// if ( payload === undefined ) {
|
||||||
|
|
@ -181,6 +184,9 @@ export default {
|
||||||
getAppEndpoint
|
getAppEndpoint
|
||||||
},
|
},
|
||||||
head() {
|
head() {
|
||||||
|
const structuredData = buildVideoStructuredData.bind(this)( this.video, this.featuredApps )
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: this.title,
|
title: this.title,
|
||||||
meta: [
|
meta: [
|
||||||
|
|
@ -209,7 +215,7 @@ export default {
|
||||||
],
|
],
|
||||||
|
|
||||||
__dangerouslyDisableSanitizers: ['script'],
|
__dangerouslyDisableSanitizers: ['script'],
|
||||||
script: [{ innerHTML: JSON.stringify( buildVideoStructuredData( this.video, this.featuredApps ) ), type: 'application/ld+json' }]
|
script: [{ innerHTML: JSON.stringify( structuredData ), type: 'application/ld+json' }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue