Skip to content

Commit

Permalink
[docs] Improve social sharing of docs pages (mui#34346)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored and Daniel Rabe committed Nov 29, 2022
1 parent 45b1b93 commit f9411ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 6 additions & 1 deletion docs/src/modules/components/AppLayoutDocs.js
Expand Up @@ -109,7 +109,12 @@ function AppLayoutDocs(props) {
}}
/>
<AdManager>
<Head title={`${title} - ${productName}`} description={description} />
<Head
title={`${title} - ${productName}`}
description={description}
largeCard={false}
card="https://mui.com/static/logo.png"
/>
{disableAd ? null : (
<AdGuest>
<Ad />
Expand Down
4 changes: 1 addition & 3 deletions docs/src/modules/components/MarkdownDocs.js
Expand Up @@ -34,7 +34,7 @@ JoyModeObserver.propTypes = {
mode: PropTypes.oneOf(['light', 'dark']),
};

function MarkdownDocs(props) {
export default function MarkdownDocs(props) {
const theme = useTheme();
const router = useRouter();
const asPathWithoutLang = router.asPath.replace(/^\/[a-zA-Z]{2}\//, '/');
Expand Down Expand Up @@ -144,5 +144,3 @@ MarkdownDocs.propTypes = {
if (process.env.NODE_ENV !== 'production') {
MarkdownDocs.propTypes = exactProp(MarkdownDocs.propTypes);
}

export default MarkdownDocs;
3 changes: 2 additions & 1 deletion docs/src/modules/components/TopLayoutBlog.js
Expand Up @@ -214,10 +214,11 @@ function TopLayoutBlog(props) {
const { description, rendered, title, headers } = docs.en;
const finalTitle = title || headers.title;
const router = useRouter();
const slug = router.pathname.replace(/\/blog\//, '');
const { canonicalAs } = pathnameToLanguage(router.asPath);
const card =
headers.card === 'true'
? `https://mui.com/static${router.pathname}/card.png`
? `https://mui.com/static/blog/${slug}/card.png`
: 'https://mui.com/static/logo.png';

return (
Expand Down

0 comments on commit f9411ed

Please sign in to comment.