One homepage is cool, but we might want to add more content. Let's create a
markdown file in our
Place the content below in a new file
# This is a fileIf you are new to Markdown, you might want to check those links:----
Now let's add a simple route to our
<Router history=browserHistory><Route path="/" component=Home /><Route path="/blog/*" component=BlogPostContainer /></Router>;
We also need to create a
BlogPostContainer component to render the posts.
;;// ...const BlogPost =<div>isLoading && "Loading..."!isLoading &&pagenode &&<article><h1>pagenodetitle</h1><BodyRenderer>pagenodebody</BodyRenderer></article><footer><Link to="/">Go to home</Link></footer></div>;// ...// ...const BlogPostContainer =;
In our example above, we are doing a
query on the path
posts. We are using
id to find a single item.
id is the filename, in our case
posts/first-post (the .md extension is ignored, and
We just created a route and a component to retrieve the markdown file. Now we can access our post by accessing directly http://localhost:3333/blog/first-post/.