Skip to content

Commit

Permalink
feat: add code-snippets for content creation (#206)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
SSmale authored Jan 3, 2024
1 parent e12ab36 commit bb2f290
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .vscode/astro-paper.code-snippets
Original file line number Diff line number Diff line change
@@ -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."
}
}
2 changes: 1 addition & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit bb2f290

Please sign in to comment.