If you are using the Visual Studio Code editor , you will find a nice Extension named jekyll-post , That extension makes it easier to create new blog posts for Jekyll-based websites. and we can modify it to make it work for Hugo too.

The first step is finding the installation directory

Win %USERPROFILE%\.vscode\extensions\rohgarg.jekyll-post-0.0.1\out\utils.js

Mac ~/.vscode/extensions/rohgarg.jekyll-post-0.0.1/out/utils.js

and then you can modify the Jekyll-template into a hugo-template

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
exports.postSnippet = `---
layout: $\{1:post\}
title: $\{2\}
date: YYYY
category: $\{3\}
author: $\{4\}
tags: [$\{5\}]
summary: $\{6\}
---
$\{7\}`;

like this

1
2
3
4
5
6
7
8
exports.postSnippet = `---
type: $\{1:post\}
date: YYYY:00+00:00
archive: talk
categories:
- 说
---
$\{7\}`;

It will help me automatically add behavior to each template element.
For example, I don’t need to “fill in the post time” or “sets up the file name” anymore.