Skip to content

Commit

Permalink
First blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
smparsons committed Oct 9, 2019
1 parent 3d7e5a5 commit f96769b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 10 additions & 0 deletions content/blog/first-post/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: First Post
date: "2019-10-09T07:53:00.000Z"
description: ""
---

This is the first post on my blog! As a web developer, I wanted to create a blog that will
cover a variety of different coding topics. I am excited to start creating some content, and
I hope it will be useful to other developers who read it. If you're interested, come back
soon! More content will be coming in the near future.
3 changes: 2 additions & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const { createFilePath } = require(`gatsby-source-filesystem`)
exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions

const blogPost = require.resolve(`./src/templates/blogPost.tsx`)
const blogPost = path.resolve(`./src/templates/blogPost.tsx`)

const result = await graphql(
`
{
Expand Down
9 changes: 3 additions & 6 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SEO from "../components/seo"
import { BlogIndexQuery, BlogIndexQuery_allMarkdownRemark_edges } from "./queryTypes/BlogIndexQuery"

const asBlogPostListing = ({ node }: BlogIndexQuery_allMarkdownRemark_edges): JSX.Element => {
const { title, date } = node.frontmatter!
const { title, date, description } = node.frontmatter!
const slug = node.fields!.slug!
return (
<article key={slug} className="blog-post-listing">
Expand All @@ -20,7 +20,7 @@ const asBlogPostListing = ({ node }: BlogIndexQuery_allMarkdownRemark_edges): JS
<section>
<p
dangerouslySetInnerHTML={{
__html: node.frontmatter!.description || node.excerpt!,
__html: description || node.excerpt!,
}}
/>
</section>
Expand All @@ -36,10 +36,7 @@ const BlogIndex = ({ data, location }: BlogIndexProps): JSX.Element => {
<SEO title="All posts" />
<div className="index-content">
<Bio />
{posts.length
? posts.map(asBlogPostListing)
: <div>At the moment, I do not have any blog posts. Please come back soon!</div>
}
{posts.map(asBlogPostListing)}
</div>
</Layout>
)
Expand Down

0 comments on commit f96769b

Please sign in to comment.