-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: LiveBlogPosting
#1471
base: master
Are you sure you want to change the base?
feat: LiveBlogPosting
#1471
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,5 @@ const blog100 = { | |
description: 'This is a mighty good description of this blog.', | ||
}, | ||
}; | ||
|
||
const blogVersions = versionSchemas(blog100); | ||
export default blogVersions; | ||
export { blogVersions as default, blog100 }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needed to reuse the schema inside the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { versionSchemas } from '@cypress/schema-tools'; | ||
import { blog100 } from './blog-schema'; | ||
|
||
const liveblog100 = { | ||
...blog100, | ||
schema: { | ||
...blog100.schema, | ||
title: 'LiveBlogPosting', | ||
description: | ||
'An example schema describing JSON-LD for type: LiveBlogPosting', | ||
properties: { | ||
...blog100.schema.properties, | ||
coverageStartTime: { | ||
type: 'string', | ||
description: | ||
'The time when the live blog will begin covering the Event. ' + | ||
"Note that coverage may begin before the Event's start time. The LiveBlogPosting may also be created before coverage begins.", | ||
}, | ||
coverageEndTime: { | ||
type: 'string', | ||
description: | ||
'The time when the live blog will stop covering the Event. Note that coverage may continue after the Event concludes.', | ||
}, | ||
liveBlogUpdate: { | ||
type: 'array', | ||
items: { | ||
...blog100.schema, | ||
required: ['@type'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not all the properties of |
||
additionalProperties: true, | ||
}, | ||
description: 'Array of blog posting updates', | ||
}, | ||
}, | ||
}, | ||
example: { | ||
...blog100.example, | ||
'@type': 'LiveBlogPosting', | ||
dateModified: '2024-05-08T22:15:00+02:00', | ||
datePublished: '2024-05-08T11:13:18+02:00', | ||
mainEntityOfPage: { | ||
'@type': 'WebPage', | ||
'@id': 'https://example.com/liveblog', | ||
}, | ||
headline: 'LiveBlog headline', | ||
coverageStartTime: '2024-05-08T09:00:01+02:00', | ||
coverageEndTime: '2024-05-09T09:00:01+02:00', | ||
liveBlogUpdate: [ | ||
{ | ||
'@type': 'BlogPosting', | ||
datePublished: '2024-05-08T22:15:00+02:00', | ||
headline: 'Final update', | ||
articleBody: 'See you soon', | ||
}, | ||
{ | ||
'@type': 'BlogPosting', | ||
datePublished: '2024-05-08T09:00:00+02:00', | ||
headline: 'Hello', | ||
articleBody: 'Live coverage demo.', | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
// Despite the liveBlogUpdate's required config, we must | ||
['author', 'mainEntityOfPage'].forEach(key => { | ||
liveblog100.schema.properties.liveBlogUpdate.items.properties[ | ||
key | ||
].required = false; | ||
}); | ||
Comment on lines
+65
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even with
are still reported as missing in the E2E tests. As we are using instances |
||
|
||
const liveBlogVersions = versionSchemas(liveblog100); | ||
export default liveBlogVersions; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import { ArticleJsonLd } from '../../..'; | ||
|
||
function LiveBlogPosting() { | ||
return ( | ||
<> | ||
<h1>LiveBlogPosting</h1> | ||
<ArticleJsonLd | ||
type="LiveBlogPosting" | ||
url="https://example.com/liveblog" | ||
title="Next.js Conf live coverage" | ||
images={[ | ||
'https://example.com/photos/1x1/photo.jpg', | ||
'https://example.com/photos/4x3/photo.jpg', | ||
'https://example.com/photos/16x9/photo.jpg', | ||
]} | ||
datePublished="2023-11-03T11:00:00+02:00" | ||
dateModified="2023-11-03T19:00:00+02:00" | ||
authorName="Jane Blogs" | ||
description="Follow the announcements made during the 2023 Next.js Conf." | ||
coverageStartTime="2023-11-03T11:00:00+02:00" | ||
coverageEndTime="2023-11-03T19:00:00+02:00" | ||
liveBlogUpdate={[ | ||
// From newer to older updates of type BlogPosting | ||
{ | ||
'@type': 'BlogPosting', | ||
headline: 'Next.js 14: No New APIs', | ||
articleBody: 'Lorem ipsum dolor sit amet …', | ||
datePublished: '2023-11-03T18:15:00+02:00', | ||
}, | ||
{ | ||
'@type': 'BlogPosting', | ||
headline: 'A faster, more personalized web.', | ||
articleBody: 'Lorem ipsum dolor sit amet …', | ||
datePublished: '2023-11-03T11:30:00+02:00', | ||
}, | ||
{ | ||
'@type': 'BlogPosting', | ||
headline: 'Conference will start soon', | ||
articleBody: 'In a few hours …', | ||
datePublished: '2023-11-03T11:00:00+02:00', | ||
}, | ||
]} | ||
Comment on lines
+23
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the correct way to declare the |
||
/> | ||
</> | ||
); | ||
} | ||
|
||
export default LiveBlogPosting; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
liveBlogUpdate
items could contain plenty of additional props because they are instances ofBlogPosting
but I decided to keep it short.