Skip to content

Commit

Permalink
feat: add pages' create time and last edited time in the frontmatter
Browse files Browse the repository at this point in the history
  • Loading branch information
alvis committed Jul 8, 2021
1 parent 64bbdc9 commit 261de93
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions source/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ export class Notion {
{
id: page.id,
title,
createdTime: page.created_time,
lastEditedTime: page.last_edited_time,
},
{ forceQuotes: true },
).trim(),
Expand Down
2 changes: 2 additions & 0 deletions spec/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ describe('cl:Notion', () => {
---
id: 'page'
title: 'Title'
createdTime: '2020-01-01T00:00:00Z'
lastEditedTime: '2020-01-01T00:00:00Z'
---
block 0 for block page
Expand Down
2 changes: 1 addition & 1 deletion spec/gatsby-node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('fn:sourceNodes', () => {
id: 'page',
last_edited_time: '2020-01-01T00:00:00Z',
markdown:
"---\nid: 'page'\ntitle: 'Title'\n---\nblock 0 for block page\n\nblock 0 for block page-block0\n",
"---\nid: 'page'\ntitle: 'Title'\ncreatedTime: '2020-01-01T00:00:00Z'\nlastEditedTime: '2020-01-01T00:00:00Z'\n---\nblock 0 for block page\n\nblock 0 for block page-block0\n",
object: 'page',
parent: { database_id: 'database-page', type: 'database_id' },
properties: {
Expand Down

0 comments on commit 261de93

Please sign in to comment.