Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
node {
fields {
slug
date
}
}
}
Expand All @@ -85,8 +86,9 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
);
const posts = blogQueryResult.data.allMarkdownRemark.edges;
posts.forEach((edge) => {
console.log(edge.node.fields.date);
createPage({
path: `/blog${edge.node.fields.slug}`,
path: `/blog${edge.node.fields.slug}-${edge.node.fields.date.replace(/[-T:.Z]/g, '-').substring(0, 10)}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier would prefer that with newlines like you did in BlogList.jsx

component: blogPostTemplate,
context: {
slug: edge.node.fields.slug,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function Index() {
return {
posttype,
title,
path: `/blog${slug}`,
path: `/blog${slug}-${date.replace(/[-T:.Z]/g, "-").substring(0, 10)}`,
cover,
tags,
excerpt,
Expand Down
4 changes: 3 additions & 1 deletion src/templates/Blog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export default class Blog extends React.Component {
<SocialLinks
title={post.title}
excerpt={post.excerpt}
path={`/blog${slug}`}
path={`/blog${slug}-${date
.replace(/[-T:.Z]/g, "-")
.substring(0, 10)}`}
/>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/templates/BlogList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ function BlogList({ data, pageContext, location }) {
return {
posttype,
title,
path: `${prefix}${slug}`,
path: `${prefix}${slug}-${date
.replace(/[-T:.Z]/g, "-")
.substring(0, 10)}`,
cover,
tags,
excerpt,
Expand Down