mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 05:57:05 +02:00
feat(v2): meta description (#1447)
* feat(v2): meta description * add description for blog as well * fix non-descriptive text link * remove font awesome * switch front-matter -> gray-matter
This commit is contained in:
parent
34195e4c30
commit
6136fbe1d2
21 changed files with 82 additions and 58 deletions
|
@ -75,7 +75,7 @@ class DocusaurusPluginContentBlog {
|
|||
);
|
||||
|
||||
const fileString = await fs.readFile(source, 'utf-8');
|
||||
const {metadata: rawMetadata} = parse(fileString);
|
||||
const {metadata: rawMetadata, excerpt: description} = parse(fileString);
|
||||
|
||||
const metadata = {
|
||||
permalink: normalizeUrl([
|
||||
|
@ -84,6 +84,7 @@ class DocusaurusPluginContentBlog {
|
|||
fileToUrl(blogFileName),
|
||||
]),
|
||||
source,
|
||||
description,
|
||||
...rawMetadata,
|
||||
date,
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const fm = require('front-matter');
|
||||
const matter = require('gray-matter');
|
||||
const {parseQuery} = require('loader-utils');
|
||||
|
||||
const TRUNCATE_MARKER = /<!--\s*truncate\s*-->/;
|
||||
|
@ -14,7 +14,7 @@ module.exports = async function(fileString) {
|
|||
const callback = this.async();
|
||||
|
||||
// Extract content of markdown (without frontmatter).
|
||||
let {body: content} = fm(fileString);
|
||||
let {content} = matter(fileString);
|
||||
|
||||
// Truncate content if requested (e.g: file.md?truncated=true)
|
||||
const {truncated} = this.resourceQuery && parseQuery(this.resourceQuery);
|
||||
|
|
|
@ -17,7 +17,7 @@ function BlogListPage(props) {
|
|||
} = props;
|
||||
|
||||
return (
|
||||
<Layout title="Blog">
|
||||
<Layout title="Blog" description="Blog">
|
||||
<div className="container margin-vert--xl">
|
||||
<div className="row">
|
||||
<div className="col col--6 col--offset-3">
|
||||
|
|
|
@ -14,7 +14,7 @@ function BlogPostPage(props) {
|
|||
const {content: BlogPostContents, metadata} = props;
|
||||
|
||||
return (
|
||||
<Layout title={metadata.title}>
|
||||
<Layout title={metadata.title} description={metadata.description}>
|
||||
{BlogPostContents && (
|
||||
<div className="container margin-vert--xl">
|
||||
<div className="row">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue