Hugo用 VSCode設定

準備

  • VSNote

Snippet

{
  "vsnote_template_blog": {
    "prefix": "vsnote_template_blog",
    "body": [
      "---",
      "title: \"\"",
      "date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}${CURRENT_TIMEZONE_OFFSET}",
      "draft : false",
      "author: [\"cyamax\"]",
      "categories: [\"\"]",
      "archives: [\"$CURRENT_YEAR\", \"$CURRENT_YEAR-$CURRENT_MONTH\"]",
      "description: \"\"",
      "url : \"/entry/$CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE/$CURRENT_HOUR$CURRENT_MINUTE$CURRENT_SECOND\"",
      "---",
      "$2",
    ],
  }
}

出力例

---
title: ""
date: 2024-07-15T15:59:44+09:00
draft : false
author: ["cyamax"]
categories: [""]
archives: ["2024", "2024-07"]
description: ""
url : "/entry/2024/07/15/155944"
---

setting.json

{
    "vsnotes.defaultNotePath": "/Users/b0ffa/project/oresugo/.vscode",
    "vsnotes.noteTitleConvertSpaces": " ",
    "vsnotes.defaultNoteTitle": "entry_{dt}.{ext}",
    "vsnotes.tokens": [
        {
            "type": "datetime",
            "token": "{dt}",
            "format": "YYYY_MM_DD_HHmmss",
            "description": "Insert formatted datetime."
        },
        {
            "type": "title",
            "token": "{title}",
            "description": "Insert note title from input box.",
            "format": "Untitled"
        },
        {
            "type": "extension",
            "token": "{ext}",
            "description": "Insert file extension.",
            "format": "md"
        }
    ],
    "vsnotes.templates": [
        "blog",
    ],
}

使い方

コマンドパレットから「VSNotes: Creat a New Note」したとき「blog」が一覧から選ぶ。