Skip to content
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

[docs] Improve social sharing of docs pages #34346

Merged
merged 1 commit into from Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small fix. It helps to search in the codebase for places were the images inside the blog folder are used.

: 'https://mui.com/static/logo.png';

return (
Expand Down