11---
2- title : Adding a List of Markdown Blog Posts
2+ title : Markdownのブログ投稿一覧を追加する
33---
44
5- Once you have added Markdown pages to your site, you are just one step away from being able to list your posts on a dedicated index page.
5+ Markdown のページをサイトに追加すると、専用のインデックスページに投稿を一覧表示できるようになります。
66
7- ## Creating posts
7+ ## 投稿を作成
88
9- As described [ here ] ( /docs/adding-markdown-pages ) , you will have to create your posts in Markdown files which will look like this:
9+ [ ここ ] ( /docs/adding-markdown-pages ) で説明しているように、投稿を Markdown ファイルで作成する必要があります。それは次のように行えます。
1010
1111``` markdown
1212---
1313path: "/blog/my-first-post"
1414date: "2017-11-07"
15- title: "My first blog post "
15+ title: "初めてのブログ投稿 "
1616---
1717
18- Has anyone heard about GatsbyJS yet?
18+ GatsbyJS って聞いたことある?
1919```
2020
21- ## Creating the page
21+ ## ページの作成
2222
23- The first step will be to create the page which will display your posts, in ` src/pages/ ` . You can for example use ` index.js ` .
23+ 最初の手順は投稿を表示するページを ` src/pages/ ` に作成することです。例えば ` index.js ` を利用できます。
2424
2525``` jsx:title=src/pages/index.js
2626import React from " react"
@@ -32,7 +32,7 @@ const IndexPage = ({
3232 },
3333}) => {
3434 const Posts = edges
35- .filter (edge => !! edge .node .frontmatter .date ) // You can filter your posts based on some criteria
35+ .filter (edge => !! edge .node .frontmatter .date ) // いくつかの基準に基づいて投稿をフィルタリングできます
3636 .map (edge => < PostLink key= {edge .node .id } post= {edge .node } / > )
3737
3838 return < div> {Posts}< / div>
@@ -41,9 +41,9 @@ const IndexPage = ({
4141export default IndexPage
4242```
4343
44- ## Creating the GraphQL query
44+ ## GraphQL のクエリを作成
4545
46- Second, you need to provide the data to your component with a GraphQL query. Add it, so that ` index.js ` looks like this:
46+ 次に、 GraphQL クエリを利用してコンポーネントにデータを提供する必要があります。 ` index.js ` に以下のように追記します。
4747
4848``` jsx:title=src/pages/index.js
4949import React from " react"
@@ -56,7 +56,7 @@ const IndexPage = ({
5656 },
5757}) => {
5858 const Posts = edges
59- .filter (edge => !! edge .node .frontmatter .date ) // You can filter your posts based on some criteria
59+ .filter (edge => !! edge .node .frontmatter .date ) // いくつかの基準に基づいて投稿をフィルタリングできます
6060 .map (edge => < PostLink key= {edge .node .id } post= {edge .node } / > )
6161
6262 return < div> {Posts}< / div>
@@ -83,9 +83,9 @@ export const pageQuery = graphql`
8383`
8484```
8585
86- ## Creating the ` PostLink ` component
86+ ## ` PostLink ` コンポーネントの作成
8787
88- The only thing left to do is to add the ` PostLink ` component. Create a new file ` post-link.js ` in ` src/components/ ` and add the following:
88+ あとは ` PostLink ` コンポーネントの作成だけです。 ` src/components/ ` に ` post-link.js ` ファイルを作成して次のように記述します。
8989
9090``` jsx:title=src/components/post-link.js
9191import React from " react"
@@ -102,4 +102,4 @@ const PostLink = ({ post }) => (
102102export default PostLink
103103```
104104
105- This should get you a page with your posts sorted by descending date. You can further customize the ` frontmatter ` and the page and ` PostLink ` components to get your desired effects!
105+ これで、日付降順でソートされた投稿が並べられたページを表示できます。さらに、 ` frontmatter ` 、ページ、 ` PostLink ` コンポーネントなどをさらにカスタマイズして、望み通りのエフェクトがかけられます!
0 commit comments