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:
Endi 2019-05-10 22:37:56 +07:00 committed by GitHub
parent 34195e4c30
commit 6136fbe1d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 82 additions and 58 deletions

View file

@ -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,
};

View file

@ -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);

View file

@ -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">

View file

@ -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">