docs(guide): move custom-templates docs and translate it (#196)

This commit is contained in:
XieZongChen 2023-03-22 11:02:35 +08:00 committed by GitHub
parent 8a3ad1a92c
commit bdb2d51289
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 35 deletions

View File

@ -1,34 +0,0 @@
# Customize post templates
Valaxy uses [ejs](https://ejs.co/) as its template generating helper, you can define your
own templates as below:
## Create a scaffold folder in your project root
```shell
$ mkdir scaffolds
```
## Create your own template to the scaffolds folder
> **Note**
> The filename you are going to create is going to be the same
with the layout name you need when you creating file with command:
> `valaxy new --layout [layout] [filename]`
```shell
$ touch scaffolds/post.md
$ cat <<EOF > scaffolds/post.md
---
layout: <%=layout%>
title: <%=title%>
date: <%=date%>
---
Some additional descriptions
EOF
```
## Using Valaxy new to quickly create a new post

View File

@ -139,7 +139,7 @@ and update the date.
> an issue at [GitHub Issues](https://github.com/YunYouJun/valaxy/issues)!
:::
- [自定义文章模板](/guide/commands/custom-templates)
- [自定义文章模板](/guide/custom/templates)
## FAQ

View File

@ -0,0 +1,60 @@
---
title: Custom Post Templates
title_zh-CN: 自定义文章模板
categories:
- Custom
end: false
---
::: zh-CN
Valaxy 使用 [ejs](https://ejs.co/) 作为模板生成助手,你可以按照以下方式定义自己的模板:
:::
::: en
Valaxy uses [ejs](https://ejs.co/) as its template generating helper, you can define your
own templates as below:
:::
## 在项目根目录中创建 scaffold 文件夹 {lang="zh-CN"}
## Create a scaffold folder in your project root {lang="en"}
```shell
$ mkdir scaffolds
```
## 在 scaffolds 文件夹中创建自己的模板 {lang="zh-CN"}
## Create your own template to the scaffolds folder {lang="en"}
<div lang="zh-CN">
> **提示**
> 你要创建的文件名将与使用命令创建文件时所需的布局名称相同:
> `valaxy new --layout [layout] [filename]`
</div>
<div lang="en">
> **Note**
> The filename you are going to create is going to be the same
with the layout name you need when you creating file with command:
> `valaxy new --layout [layout] [filename]`
</div>
```shell
$ touch scaffolds/post.md
$ cat <<EOF > scaffolds/post.md
---
layout: <%=layout%>
title: <%=title%>
date: <%=date%>
---
Some additional descriptions
EOF
```