-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
feat(v2): support custom description for blog-only mode #2359
Changes from 6 commits
093ca83
478f4fb
31d26f6
8317fbc
678fe67
373ccea
77bacef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,7 +13,7 @@ import BlogPostItem from '@theme/BlogPostItem'; | |||||
import BlogListPaginator from '@theme/BlogListPaginator'; | ||||||
|
||||||
type Props = { | ||||||
metadata: {permalink: string; title: string}; | ||||||
metadata: {permalink: string; title: string; blogDescription: string}; | ||||||
items: {content}[]; | ||||||
}; | ||||||
|
||||||
|
@@ -24,10 +24,10 @@ function BlogListPage(props: Props): JSX.Element { | |||||
} = useDocusaurusContext(); | ||||||
const isBlogOnlyMode = metadata.permalink === '/'; | ||||||
const title = isBlogOnlyMode ? siteTitle : 'Blog'; | ||||||
|
||||||
const {blogDescription} = metadata; | ||||||
return ( | ||||||
<Layout title={title} description="Blog"> | ||||||
<div className="container margin-vert--lg"> | ||||||
<Layout title={title} description={blogDescription}> | ||||||
<div className="container margin-vert--xl"> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It's not the purpose of this PR to change the design. I'm open to discussing this but in another PR. I think it looks weird on mobile to have as much There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh! This might be accidentally merged from a conflict, I will correct it. |
||||||
<div className="row"> | ||||||
<main className="col col--8 col--offset-2"> | ||||||
{items.map(({content: BlogPostContent}) => ( | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -163,6 +163,24 @@ Don't forget to delete the existing homepage at `./src/pages/index.js` or else t | |||||
|
||||||
::: | ||||||
|
||||||
You can also add meta description to the blog list page for better SEO: | ||||||
|
||||||
```js {8} title="docusaurus.config.js" | ||||||
module.exports = { | ||||||
// ... | ||||||
presets: [ | ||||||
[ | ||||||
'@docusaurus/preset-classic', | ||||||
{ | ||||||
blog: { | ||||||
blogDescription: 'A docusuarus powered blog!', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}, | ||||||
}, | ||||||
], | ||||||
], | ||||||
}; | ||||||
``` | ||||||
|
||||||
### Multiple blogs | ||||||
|
||||||
By default, the classic theme assumes only one blog per website and hence includes only one instance of the blog plugin. If you would like to have multiple blogs on a single website, it's possible too! You can add another blog by specifying another blog plugin in the `plugins` option for `docusaurus.config.js`. | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -200,6 +200,10 @@ module.exports = { | |||||
*/ | ||||||
editUrl: | ||||||
'https://github.com/facebook/docusaurus/edit/master/website/blog/', | ||||||
/** | ||||||
* Blog page meta description for better SEO | ||||||
*/ | ||||||
blogDescription: '', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/** | ||||||
* URL route for the blog section of your site. | ||||||
* *DO NOT* include a trailing slash. | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it retrocompatible, it displays Blog by default currently