gatsby-starter-blog のデフォルトでは一覧に本文の一部が表示されるようになっているが、以前使用していた gatsby-blog-mdx では frontmatter に excerpt というものがあり区別されていて、今回もそれをやりたい、という話。
一覧ページを作るための src/pages/index.js
を見てみると以下のようになっていて、 frontmatter に description という項目を追加すると目的が達成できそうなことがわかった。
<section>
<p
dangerouslySetInnerHTML={{
__html: post.frontmatter.description || post.excerpt,
}}
itemProp="description"
/>
</section>
---
description: この記事はこういう話です
---
でけた!