Skip to content

Commit

Permalink
[docs] Fix SEO issues
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Mar 15, 2020
1 parent b023308 commit 4357e89
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 45 deletions.
2 changes: 1 addition & 1 deletion docs/pages/blog/material-ui-v1-is-out.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ We want to translate the documentation into Chinese and more languages. [Any hel

We have shipped the long-awaited Material-UI v1 stable release. With a new codebase designed to better support customization, it’s the perfect timing to start building and promoting premium themes. We are very happy to announce [the first two](https://material-ui.com/store/) from [Creative Tim](https://material-ui.com/store/contributors/creative-tim/). More are coming.

![[Creative Tim](https://material-ui.com/store/contributors/creative-tim/) themes](https://cdn-images-1.medium.com/max/2000/1*jPOu6n1EMsqv4Gh652MtPA.png)
![Creative Tim themes](https://cdn-images-1.medium.com/max/2000/1*jPOu6n1EMsqv4Gh652MtPA.png)
<p class="blog-description">Creative Tim themes</p>

![A preview of an open source theme we will soon release.](https://cdn-images-1.medium.com/max/2000/1*CThJG6Kuk-XlSM53jM6KLQ.png)
Expand Down
54 changes: 21 additions & 33 deletions docs/src/modules/components/HomeSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@ const UsageLink = React.forwardRef((buttonProps, ref) => (
));

const styles = theme => ({
container: {
root: {
marginTop: theme.spacing(5),
'& pre': {
margin: theme.spacing(1, 0),
},
},
step: {
border: `12px solid ${theme.palette.background.level1}`,
borderRightWidth: 0,
borderLeftWidth: 0,
padding: theme.spacing(3, 2),
padding: theme.spacing(2),
backgroundColor: theme.palette.background.level2,
[theme.breakpoints.up('md')]: {
padding: theme.spacing(5, 4),
padding: theme.spacing(3),
},
},
leftStep: {
Expand Down Expand Up @@ -60,17 +63,7 @@ const styles = theme => ({
fontSize: 30,
},
stepBody: {
minHeight: 290,
},
markdownElement: {
maxWidth: `calc(100vw - ${(theme.spacing(5) + 1) * 2}px)`,
'& pre, & pre[class*="language-"], & code': {
// backgroundColor: 'transparent',
},
'& pre, & pre[class*="language-"]': {
padding: theme.spacing(1, 0),
margin: theme.spacing(1, 0),
},
minHeight: 270,
},
divider: {
marginTop: theme.spacing(4),
Expand All @@ -92,7 +85,7 @@ function HomeSteps(props) {
const t = useSelector(state => state.options.t);

return (
<Container disableGutters maxwidth="lg" className={classes.container}>
<Container disableGutters maxwidth="lg" className={classes.root}>
<Grid container>
<Grid item xs={12} md={6} className={clsx(classes.step, classes.leftStep)}>
<div className={classes.stepTitle}>
Expand All @@ -106,11 +99,10 @@ function HomeSteps(props) {
{t('installDescr')}
</Typography>
<MarkdownElement
className={classes.markdownElement}
text={`
\`\`\`sh
$ npm install @material-ui/core
\`\`\`
\`\`\`sh
$ npm install @material-ui/core
\`\`\`
`}
/>
<Link
Expand All @@ -125,11 +117,10 @@ function HomeSteps(props) {
{t('loadFont')}
</Typography>
<MarkdownElement
className={classes.markdownElement}
text={`
\`\`\`html
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
\`\`\`
\`\`\`html
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
\`\`\`
`}
/>
</div>
Expand All @@ -148,18 +139,15 @@ function HomeSteps(props) {
{t('usageDescr')}
</Typography>
<MarkdownElement
className={classes.markdownElement}
text={`
\`\`\`jsx
import React from 'react';
import Button from '@material-ui/core/Button';
\`\`\`jsx
import React from 'react';
import { Button } from '@material-ui/core';
const App = () => (
<Button variant="contained" color="primary">
Hello World
</Button>
);
\`\`\`
function App() {
return <Button color="primary">Hello World</Button>;
}
\`\`\`
`}
/>
</div>
Expand Down
8 changes: 6 additions & 2 deletions docs/src/modules/components/MarkdownElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,17 @@ const styles = theme => ({
position: 'absolute',
},
'& pre': {
margin: '24px 0',
padding: '12px 18px',
margin: theme.spacing(3, 0),
padding: theme.spacing(2),
backgroundColor: '#272c34',
direction: 'ltr',
borderRadius: theme.shape.borderRadius,
overflow: 'auto',
WebkitOverflowScrolling: 'touch', // iOS momentum scrolling.
maxWidth: 'calc(100vw - 32px)',
[theme.breakpoints.up('md')]: {
maxWidth: 'calc(100vw - 32px - 16px)',
},
},
'& code': {
display: 'inline-block',
Expand Down
10 changes: 6 additions & 4 deletions docs/src/modules/components/TopLayoutBlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ const styles = theme => ({
marginBottom: theme.spacing(20),
maxWidth: 680 + theme.spacing(8 + 4),
'& .markdownElement': {
paddingRight: theme.spacing(4),
fontSize: 18,
lineHeight: 1.7,
[theme.breakpoints.up('md')]: {
paddingRight: theme.spacing(4),
},
},
'& img': {
display: 'block',
Expand All @@ -36,7 +38,7 @@ const styles = theme => ({
},
});

function TopLayoutCompany(props) {
function TopLayoutBlog(props) {
const {
classes,
markdown: markdownProp,
Expand Down Expand Up @@ -80,7 +82,7 @@ function TopLayoutCompany(props) {
);
}

TopLayoutCompany.propTypes = {
TopLayoutBlog.propTypes = {
classes: PropTypes.object.isRequired,
markdown: PropTypes.string,
// You can define the direction location of the markdown file.
Expand All @@ -91,4 +93,4 @@ TopLayoutCompany.propTypes = {
reqSource: PropTypes.func,
};

export default withStyles(styles)(TopLayoutCompany);
export default withStyles(styles)(TopLayoutBlog);
4 changes: 3 additions & 1 deletion docs/src/modules/components/TopLayoutCompany.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const styles = theme => ({
marginBottom: theme.spacing(20),
maxWidth: 680 + theme.spacing(8 + 4),
'& .markdownElement': {
paddingRight: theme.spacing(4),
[theme.breakpoints.up('md')]: {
paddingRight: theme.spacing(4),
},
},
},
});
Expand Down
7 changes: 3 additions & 4 deletions docs/src/modules/components/useMarkdownDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,15 @@ export default function useMarkdownDocs(options) {
}

if (headers.components.length > 0) {
const section = location.split('/')[4];
contents.push(`
## API
${headers.components
.map(
component =>
`- [&lt;${component} /&gt;](${
section === 'lab' ? '/lab/api' : '/api'
}/${Router2._rewriteUrlForNextExport(kebabCase(component))})`,
`- [&lt;${component} /&gt;](${Router2._rewriteUrlForNextExport(
`/api/${kebabCase(component)}`,
)})`,
)
.join('\n')}
`);
Expand Down

0 comments on commit 4357e89

Please sign in to comment.