Skip to content

Commit

Permalink
[docs] Add author and published_time meta tags (mui#34382)
Browse files Browse the repository at this point in the history
Co-authored-by: Olivier Tassinari <[email protected]>
  • Loading branch information
2 people authored and Daniel Rabe committed Nov 29, 2022
1 parent a7916a7 commit 2254b40
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 72 deletions.
41 changes: 20 additions & 21 deletions docs/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,26 @@ export default function Home() {
<Head
title="MUI: The React component library you always wanted"
description="MUI provides a simple, customizable, and accessible library of React components. Follow your own design system, or start with Material Design."
/>
>
<script
type="application/ld+json"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'Organization',
name: 'MUI',
url: 'https://mui.com/',
logo: 'https://mui.com/static/logo.png',
sameAs: [
'https://twitter.com/MUI_hq',
'https://github.com/mui/',
'https://opencollective.com/mui',
],
}),
}}
/>
</Head>
<NoSsr>
<NewsletterToast />
</NoSsr>
Expand All @@ -40,26 +59,6 @@ export default function Home() {
<Divider />
</main>
<AppFooter />
<script
type="application/ld+json"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: `
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "MUI",
"url": "https://mui.com/",
"logo": "https://mui.com/static/logo.png",
"sameAs": [
"https://twitter.com/MUI_hq",
"https://github.com/mui/",
"https://opencollective.com/mui"
]
}
`,
}}
/>
</BrandingCssVarsProvider>
);
}
101 changes: 50 additions & 51 deletions docs/src/modules/components/TopLayoutBlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,56 @@ function TopLayoutBlog(props) {
disableAlternateLocale
card={card}
type="article"
/>
>
<meta name="author" content={headers.authors.map((key) => authors[key].name).join(', ')} />
<meta property="article:published_time" content={headers.date} />
<script
type="application/ld+json"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'Article',
publisher: {
'@type': 'Organization',
name: 'MUI blog',
url: 'https://mui.com/blog/',
logo: {
'@type': 'ImageObject',
url: 'https://mui.com/static/icons/512x512.png',
},
},
author: {
'@type': 'Person',
name: authors[headers.authors[0]].name,
image: {
'@type': 'ImageObject',
url: `${authors[headers.authors[0]].avatar}?s=${250}`,
width: 250,
height: 250,
},
sameAs: [`https://github.com/${authors[headers.authors[0]].github}`],
},
headline: finalTitle,
url: `https://mui.com${canonicalAsServer}`,
datePublished: headers.date,
dateModified: headers.date,
image: {
'@type': 'ImageObject',
url: card,
width: 1280,
height: 640,
},
keywords: headers.tags.join(', '),
description,
mainEntityOfPage: {
'@type': 'WebPage',
'@id': 'https://mui.com/blog/',
},
}),
}}
/>
</Head>
<Root className={className}>
<AppContainer component="main" className={classes.container}>
<Link
Expand Down Expand Up @@ -294,56 +343,6 @@ function TopLayoutBlog(props) {
<Divider />
<AppFooter />
</Root>
<script
type="application/ld+json"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: `
{
"@context": "https://schema.org",
"@type": "Article",
"publisher": {
"@type": "Organization",
"name": "MUI blog",
"url": "https://mui.com/blog/",
"logo": {
"@type": "ImageObject",
"url": "https://mui.com/static/icons/512x512.png"
}
},
"author": {
"@type": "Person",
"name": "${authors[headers.authors[0]].name}",
"image": {
"@type": "ImageObject",
"url": "${authors[headers.authors[0]].avatar}?s=${250}",
"width": 250,
"height": 250
},
"sameAs": [
"https://github.com/${authors[headers.authors[0]].github}"
]
},
"headline": "${finalTitle}",
"url": "https://mui.com${canonicalAsServer}",
"datePublished": "${headers.date}",
"dateModified": "${headers.date}",
"image": {
"@type": "ImageObject",
"url": "${card}",
"width": 1280,
"height": 640
},
"keywords": "${headers.tags.join(', ')}",
"description": "${description}",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://mui.com/blog/"
}
}
`,
}}
/>
</BrandingProvider>
);
}
Expand Down

0 comments on commit 2254b40

Please sign in to comment.