mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-15 01:25:28 +01:00
date fixes
This commit is contained in:
parent
a6affd683f
commit
7206eca86c
@ -27,15 +27,13 @@ exports.createPages = async ({ graphql, actions }) => {
|
|||||||
|
|
||||||
const result = await graphql(`
|
const result = await graphql(`
|
||||||
{
|
{
|
||||||
allMarkdownRemark(sort: { fields: [fields___date], order: DESC }) {
|
allMarkdownRemark {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
fields {
|
fields {
|
||||||
slug
|
slug
|
||||||
date
|
|
||||||
}
|
}
|
||||||
frontmatter {
|
frontmatter {
|
||||||
type
|
|
||||||
tags
|
tags
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,11 @@ exports.createMarkdownFields = (node, createNodeField, getNode) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// date
|
// date
|
||||||
let date
|
// grab date from file path
|
||||||
|
let date = new Date(slugOriginal.substring(1, 11)).toISOString() // grab date from file path
|
||||||
|
|
||||||
if (node.frontmatter.date) {
|
if (node.frontmatter.date) {
|
||||||
date = `${node.frontmatter.date}`
|
date = new Date(node.frontmatter.date).toISOString()
|
||||||
} else {
|
|
||||||
date = `${slugOriginal.substring(1, 10)}` // grab date from file path
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createNodeField({
|
createNodeField({
|
||||||
|
Loading…
Reference in New Issue
Block a user