Skip to content

Commit

Permalink
posts.
Browse files Browse the repository at this point in the history
  • Loading branch information
bradgarropy committed Mar 25, 2020
1 parent 0564a72 commit e96caee
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const createPostPage = (post, createPage) => {
const {slug} = post.frontmatter

createPage({
path: `/blog/${slug}`,
path: `/posts/${slug}`,
component: path.resolve("./src/templates/post.js"),
context: {slug},
})
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const Navigation = ({open = true}) => {

return (
<StyledNavigation open={open}>
<StyledLink to="/blog" onClick={onClick}>
blog
<StyledLink to="/posts" onClick={onClick}>
posts
</StyledLink>

<StyledLink to="/episodes" onClick={onClick}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Posts/FeaturedPosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ const FeaturedPosts = ({posts}) => {

return (
<StyledPost key={index}>
<Link to={`/blog/${slug}`}>
<Link to={`/posts/${slug}`}>
<Image fluid={image} />
</Link>

<PostMeta>
<PostTitle to={`/blog/${slug}`}>
<PostTitle to={`/posts/${slug}`}>
<h2>{title}</h2>
</PostTitle>
</PostMeta>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Posts/Post.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Post = ({post}) => {

return (
<StyledPost>
<Link to={`/blog/${slug}`}>
<Link to={`/posts/${slug}`}>
<Image fluid={image} />
</Link>

Expand Down
2 changes: 1 addition & 1 deletion src/components/Posts/PostMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const PostMeta = ({post}) => {
<StyledPostMeta>
<span>{date}</span>

<PostTitle to={`/blog/${slug}`}>
<PostTitle to={`/posts/${slug}`}>
<Title>{title}</Title>
</PostTitle>

Expand Down
8 changes: 4 additions & 4 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const MoreButton = styled(Link)`
secondary ? theme.colors.red : theme.colors.white};
`

const BlogSection = styled.div`
const PostsSection = styled.div`
display: grid;
gap: 2rem;
`
Expand Down Expand Up @@ -49,13 +49,13 @@ const IndexPage = () => {
<SEO />

<Section color="white">
<BlogSection>
<PostsSection>
<SectionHeader>latest posts</SectionHeader>
<FeaturedPosts posts={posts} />
<MoreButton secondary="true" to="/blog">
<MoreButton secondary="true" to="/posts">
read more
</MoreButton>
</BlogSection>
</PostsSection>
</Section>

<Section color="red">
Expand Down
10 changes: 5 additions & 5 deletions src/pages/blog.js → src/pages/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import {SEO} from "../components/SEO"
import Container from "../styles/Container"
import Posts from "../components/Posts/Posts"

const BlogPage = ({uri}) => {
const PostsPage = ({uri}) => {
const posts = usePosts()

return (
<Container>
<SEO path={uri} title="Blog" />
<SEO path={uri} title="Posts" />

<h1>blog</h1>
<h1>posts</h1>
<Posts posts={posts} />
</Container>
)
}

BlogPage.propTypes = {
PostsPage.propTypes = {
uri: PropTypes.string.isRequired,
}

export default BlogPage
export default PostsPage
1 change: 1 addition & 0 deletions src/styles/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import styled from "styled-components"

const Container = styled.div`
display: grid;
justify-content: center;
padding: 3rem 4rem;
`

Expand Down

0 comments on commit e96caee

Please sign in to comment.