My markdown has some extra remarks and looks like this:
---
path: "/"
date: "2018-10-12"
title: "xxxx"
description: "desccc"
---
some of the text
How can I get the description?
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
limit: 1000
) {
edges {
node {
frontmatter {
path
title
date
}
}
}
}
}
Well, that head part of the markdown document is most commonly referred as frontmatter
and is automatically transformed for you so just add the description
field to your graphql query inside the frontmatter { ... }
structure and use it as your would use the title
field for example.