From 8a0da55d1cb48df3357d9f91c8bcb4d936c2282e Mon Sep 17 00:00:00 2001 From: Georgi Yanev Date: Sat, 21 Jul 2018 12:05:20 +0300 Subject: [PATCH] Make SEO score in Lighthouse = 100 For meta description used `excerpt` as it's close enough and doesn't require adding an extra frontmatter field. --- src/pages/index.js | 11 ++++++++++- src/templates/blog-post.js | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pages/index.js b/src/pages/index.js index 3657232..99d2aae 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -10,11 +10,19 @@ import { rhythm } from '../utils/typography' class BlogIndex extends React.Component { render() { const siteTitle = get(this, 'props.data.site.siteMetadata.title') + const siteDescription = get( + this, + 'props.data.site.siteMetadata.description' + ) const posts = get(this, 'props.data.allMarkdownRemark.edges') return ( - + {posts.map(({ node }) => { const title = get(node, 'frontmatter.title') || node.fields.slug @@ -46,6 +54,7 @@ export const pageQuery = graphql` site { siteMetadata { title + description } } allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) { diff --git a/src/templates/blog-post.js b/src/templates/blog-post.js index 9e54c49..049ffcd 100644 --- a/src/templates/blog-post.js +++ b/src/templates/blog-post.js @@ -11,13 +11,15 @@ class BlogPostTemplate extends React.Component { render() { const post = this.props.data.markdownRemark const siteTitle = get(this.props, 'data.site.siteMetadata.title') + const siteDescription = post.excerpt const { previous, next } = this.props.pageContext return (

{post.frontmatter.title}