From 14e29366087fcb846b766fcb8d8454dbc2d9705a Mon Sep 17 00:00:00 2001 From: Simon Smale Date: Wed, 3 Jan 2024 09:57:33 +0000 Subject: [PATCH] feat: add code-snippets for content creation (#206) * Create astro-paper.code-snippets * feat: allow nullable modDatetime this is needed to allow the snippet to work with a blank date time, and is a precursor of adding in a modified date time setting hook * Update astro-paper.code-snippets to make feat false by default --- .vscode/astro-paper.code-snippets | 34 +++++++++++++++++++++++++++++++ src/content/config.ts | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .vscode/astro-paper.code-snippets diff --git a/.vscode/astro-paper.code-snippets b/.vscode/astro-paper.code-snippets new file mode 100644 index 0000000..71af467 --- /dev/null +++ b/.vscode/astro-paper.code-snippets @@ -0,0 +1,34 @@ +{ + "Frontmatter": { + "scope": "markdown", + "prefix": "frontmatter", + "body": [ + "---", + "author: $1", + "pubDatetime: $CURRENT_YEAR-$CURRENT_MONTH-${CURRENT_DATE}T$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND.000Z", + "modDatetime: $3", + "title: $4", + "featured: ${5|false,true|}", + "draft: ${6|true,false|}", + "tags:", + " - $7", + "description: $8", + "---", + ], + "description": "Adds the frontmatter block for the AstroPaper Blog post" + }, + "Blog Template": { + "scope": "markdown", + "prefix": "template", + "body": [ + "${1:frontmatter}", + "", + "${2: Introductory Sentence}", + "", + "## Table of contents", + "", + "## ${3: heading 1}", + ], + "description": "Adds the template for the AstroPaper Blog post. You will need to trigger the snippet modal on the 'frontmatter' line to insert the other snipper." + } +} diff --git a/src/content/config.ts b/src/content/config.ts index 10b6bca..4315718 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -7,7 +7,7 @@ const blog = defineCollection({ z.object({ author: z.string().default(SITE.author), pubDatetime: z.date(), - modDatetime: z.date().optional(), + modDatetime: z.date().optional().nullable(), title: z.string(), featured: z.boolean().optional(), draft: z.boolean().optional(),