Skip to content

Commit

Permalink
docs(guide): move custom-templates docs and translate it (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
XieZongChen committed Mar 22, 2023
1 parent 8a3ad1a commit bdb2d51
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 35 deletions.
34 changes: 0 additions & 34 deletions docs/pages/guide/commands/custom-templates.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/pages/guide/commands/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
60 changes: 60 additions & 0 deletions docs/pages/guide/custom/templates.md
Original file line number Diff line number Diff line change
@@ -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
```

2 comments on commit bdb2d51

@vercel
Copy link

@vercel vercel bot commented on bdb2d51 Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://yun.valaxy.site as production
🚀 Deployed on https://641a70242d11a52fa24ed9d0--valaxy.netlify.app

Please sign in to comment.