File Template
配置路径:File > New > Edit File Templates...,会打开 File and Code Templates 窗口。
Hugo Note
快速生成 Hugo 文章文件及元信息,替代
hugo new命令。
在 Files 界面,插入新的模板:
Name: Hugo Note
Extension: md
File name: ${YEAR}-${MONTH}-${DAY}-${NAME}
---
title: "${NAME}"
date: ${YEAR}-${MONTH}-${DAY}T${HOUR}:${MINUTE}:${SECOND}+08:00
lastMod: ${YEAR}-${MONTH}-${DAY}T${HOUR}:${MINUTE}:${SECOND}+08:00
slug: ""
description: ""
summary: ""
tags:
-
series:
-
keywords:
-
##weight: 1
shotTop: true
draft: true
---以上内容按个人需求更改。
使用方式:File > New > Hugo Note。
输入文件名,如 TestNote,则会创建文件 2024-05-10-TestNote.md (日期为创建文件日期)
作者优先使用文件名中的日期作为文章日期,hugo 配置如下:
| |
如果你不需要,上述模板中 File name 请留空。
Live Template
使用 Live Template 配合 ShortCode 可以快速实现期望样式。
配置路径:File > Settings > Editor > Live Templates,添加 Live Template。
ShortCode
通用,快速生成 Hugo ShortCode 结构。
Abbreviation: shortcode
Description: Hugo ShortCode
Template text:
{{< $1$ >}}
$END$
{{< /$1$ >}}Applicable contexts Define: Other
admonition
Abbreviation: admonition
Description: Hugo ShortCode admonition
Template text:
{{< admonition type=$1$ title=$2$ open=true >}}
$END$
{{< /admonition >}}Applicable contexts Define: Other
hl
Abbreviation: hl
Description: Hugo ShortCode text highlight
Template text:
{{< hl >}}$END${{< /hl >}}Applicable contexts Define: Other
最后
你可以基于你的使用场景,将高频内容配置为 File Template 或 Live Template,提高文章编写效率。


感谢您的耐心阅读!来选个表情,或者留个评论吧!