Copilot commented on code in PR #2018:
URL: https://github.com/apache/apisix-website/pull/2018#discussion_r3069481420
##########
blog/src/theme/BlogPostPage/index.tsx:
##########
@@ -133,6 +133,37 @@ const BlogPostPage = (props: Props): JSX.Element => {
{tags.length > 0 && (
<meta property="article:tag" content={tags.map((tag) =>
tag.label).join(',')} />
)}
+ <script type="application/ld+json">
+ {JSON.stringify({
+ '@context': 'https://schema.org',
+ '@type': 'BlogPosting',
+ headline: title,
+ description,
+ datePublished: date,
+ ...(image && { image }),
+ author: authors.map((author) => ({
+ '@type': 'Person',
+ name: author.name,
+ ...(author.url && { url: author.url }),
+ ...(author.imageURL && { image: author.imageURL }),
+ })),
+ ...(tags.length > 0 && {
+ keywords: tags.map((tag) => tag.label).join(', '),
+ }),
+ publisher: {
+ '@type': 'Organization',
+ name: 'Apache APISIX',
+ logo: {
+ '@type': 'ImageObject',
+ url: 'https://apisix.apache.org/img/logo2.svg',
+ },
+ },
+ mainEntityOfPage: {
+ '@type': 'WebPage',
+ '@id': metadata.permalink,
+ },
Review Comment:
`mainEntityOfPage.@id` is set to `metadata.permalink`, which appears to be a
relative path in this codebase (e.g., `BlogLayout` builds share URLs as
`https://apisix.apache.org${permalink}`). For JSON-LD, `@id` should be the
canonical absolute URL of the page; consider prefixing with the site origin /
`siteConfig.url`.
##########
blog/src/theme/BlogPostPage/index.tsx:
##########
@@ -133,6 +133,37 @@ const BlogPostPage = (props: Props): JSX.Element => {
{tags.length > 0 && (
<meta property="article:tag" content={tags.map((tag) =>
tag.label).join(',')} />
)}
+ <script type="application/ld+json">
+ {JSON.stringify({
+ '@context': 'https://schema.org',
+ '@type': 'BlogPosting',
+ headline: title,
+ description,
+ datePublished: date,
+ ...(image && { image }),
+ author: authors.map((author) => ({
Review Comment:
`image` in the JSON-LD is taken directly from `assets.image ??
frontMatter.image`, which can be a relative URL. Google structured data
validation typically expects an absolute URL here; consider normalizing to an
absolute URL (e.g., via Docusaurus `withBaseUrl(..., { absolute: true })` or
siteConfig.url) before emitting it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]