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.
This commit is contained in:
parent
ca3b074d29
commit
8a0da55d1c
2 changed files with 14 additions and 2 deletions
|
|
@ -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 (
|
||||
<Layout location={this.props.location}>
|
||||
<Helmet title={siteTitle} htmlAttributes={{ lang: 'en' }} />
|
||||
<Helmet
|
||||
htmlAttributes={{ lang: 'en' }}
|
||||
meta={[{ name: 'description', content: siteDescription }]}
|
||||
title={siteTitle}
|
||||
/>
|
||||
<Bio />
|
||||
{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 }) {
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<Layout location={this.props.location}>
|
||||
<Helmet
|
||||
title={`${post.frontmatter.title} | ${siteTitle}`}
|
||||
htmlAttributes={{ lang: 'en' }}
|
||||
meta={[{ name: 'description', content: siteDescription }]}
|
||||
title={`${post.frontmatter.title} | ${siteTitle}`}
|
||||
/>
|
||||
<h1>{post.frontmatter.title}</h1>
|
||||
<p
|
||||
|
|
@ -80,6 +82,7 @@ export const pageQuery = graphql`
|
|||
}
|
||||
markdownRemark(fields: { slug: { eq: $slug } }) {
|
||||
id
|
||||
excerpt
|
||||
html
|
||||
frontmatter {
|
||||
title
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue