Skip to content

Commit

Permalink
Update zh-cn doc
Browse files Browse the repository at this point in the history
  • Loading branch information
binsee committed Mar 1, 2015
1 parent 7894ca7 commit c3f4070
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 15 deletions.
10 changes: 9 additions & 1 deletion source/zh-cn/docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,12 @@ $ hexo --config custom.yml
$ hexo --draft
```

显示 `source/_drafts` 文件夹中的草稿文章。
显示 `source/_drafts` 文件夹中的草稿文章。

### 自定义 CWD

``` bash
$ hexo --cwd /path/to/cwd
```

自定义当前工作目录(Current working directory)的路径。
15 changes: 8 additions & 7 deletions source/zh-cn/docs/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,47 +192,47 @@ title: 辅助函数(Helpers)
检查目前是否为文章。
``` js
<%- is_home() %>
<%- is_post() %>
```
### is_archive
检查目前是否为存档页面。
``` js
<%- is_home() %>
<%- is_archive() %>
```
### is_year
检查目前是否为年度归档页面。
``` js
<%- is_home() %>
<%- is_year() %>
```
### is_month
检查目前是否为月度归档页面。
``` js
<%- is_home() %>
<%- is_month() %>
```
### is_category
检查目前是否为分类归档页面。
``` js
<%- is_home() %>
<%- is_category() %>
```
### is_tag
检查目前是否为标签归档页面。
``` js
<%- is_home() %>
<%- is_tag() %>
```
## 字符串处理
Expand Down Expand Up @@ -645,4 +645,5 @@ title: 辅助函数(Helpers)
```
[颜色关键字]: http://www.w3.org/TR/css3-color/#svg-color
[Moment.js]: http://momentjs.com/
[Moment.js]: http://momentjs.com/
[Open Graph]: http://ogp.me/
20 changes: 19 additions & 1 deletion source/zh-cn/docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,26 @@ new_post_name: :year-:month-:day-:title.md
$ npm install hexo-migrator-wordpress --save
```

插件安装完成后,执行下列命令来迁移所有文章。`source` 可以是文件路径或网址。
在 WordPress 仪表盘中导出数据("Tools" → "Export" → "WordPress")(详情参考[WP支持页面](http://en.support.wordpress.com/export/))。

插件安装完成后,执行下列命令来迁移所有文章。`source` 可以是 WordPress 导出的文件路径或网址。

``` bash
$ hexo migrate wordpress <source>
```

## Joomla

首先,安装 `hexo-migrator-joomla` 插件。

```bash
$ npm install hexo-migrator-joomla --save
```

使用 [J2XML](http://extensions.joomla.org/extensions/migration-a-conversion/data-import-a-export/12816?qh=YToxOntpOjA7czo1OiJqMnhtbCI7fQ%3D%3D) 组件导出 Joomla 文章。
插件安装完成后,执行下列命令来迁移所有文章。`source` 可以是 Joomla 导出的文件路径或网址。


```bash
$ hexo migrate joomla <source>
```
37 changes: 32 additions & 5 deletions source/zh-cn/docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Hexo 有强大的插件系统,使您能轻松扩展功能而不用修改核心

如果您的代码很简单,建议您编写脚本,您只需要把 JavaScript 文件放到 `scripts` 文件夹,在启动时就会自动载入。

### 套件(Packages)
### 插件(Packages)

如果您的代码较复杂,或是您想要发布到 NPM 上,建议您编写插件。首先,在 `node_modules` 文件夹中建立文件夹,文件夹名称开头必须为 `hexo-`,如此一来 Hexo 才会在启动时载入。文件夹内至少要包含 2 个文件:一个是主程序,另一个是 `package.json`,描述插件的用途和所依赖的插件。

Expand Down Expand Up @@ -51,7 +51,34 @@ Hexo 共有九种插件,您可以在 API 页面中获得更多信息:

### 发布

[hexo-fs]: https://github.com/hexojs/fs
[hexo-util]: https://github.com/hexojs/util
[hexo-i18n]: https://github.com/hexojs/i18n
[hexo-pagination]: https://github.com/hexojs/hexo-pagination
当您完成插件后,可以考虑将它发布到 [插件列表](/plugins),让更多人能够使用您的插件。发布插件的步骤和 [更新文件](contributing.html#更新文件) 非常类似。

1. Fork [hexojs/site]
2. 把库(repository)复制到电脑上,并安装所依赖的插件。

{% code %}
$ git clone https://github.com/<username>/site.git
$ cd site
$ npm install
{% endcode %}

3. 编辑 `source/_data/plugins.yml`,在档案中新增您的插件,例如:

{% code %}
- name: hexo-server
description: Server module for Hexo.
link: https://github.com/hexojs/hexo-server
tags:
- official
- server
- console
{% endcode %}

4. 推送(push)分支。
5. 建立一个新的合并申请(pull request)。

[hexo-fs]: https://github.com/hexojs/hexo-fs
[hexo-util]: https://github.com/hexojs/hexo-util
[hexo-i18n]: https://github.com/hexojs/hexo-i18n
[hexo-pagination]: https://github.com/hexojs/hexo-pagination
[hexojs/site]: https://github.com/hexojs/site
32 changes: 31 additions & 1 deletion source/zh-cn/docs/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,38 @@ Swig: layout.swig
如果文件可以被渲染的话,会经过解析然后储存到 `public` 文件夹,否则会直接拷贝到 `public` 文件夹。

### 发布
当您完成主题后,可以考虑将它发布到 [主题列表](/themes),让更多人能够使用您的主题。在发布前建议先进行 [主题单元测试](https://github.com/hexojs/hexo-theme-unit-test),确保每一项功能都能正常使用。发布主题的步骤和 [更新文件](contributing.html#更新文件) 非常类似。

1. Fork [hexojs/site]
2. 把库(repository)复制到电脑上,并安装所依赖的插件。

{% code %}
$ git clone https://github.com/<username>/site.git
$ cd site
$ npm install
{% endcode %}

3. 编辑 `source/_data/themes.yml`,在文件中新增您的主题,例如:

{% code %}
- name: landscape
description: A brand new default theme for Hexo.
link: https://github.com/hexojs/hexo-theme-landscape
preview: http://hexo.io/hexo-theme-landscape
tags:
- official
- responsive
- widget
- two_column
- one_column
{% endcode %}

4.`source/themes/screenshots` 新增同名的截图档案,图片必须为 800x500 的 PNG 文件。
5. 推送(push)分支。
6. 建立一个新的合并申请(pull request)。

[EJS]: https://github.com/hexojs/hexo-renderer-ejs
[Swig]: http://paularmstrong.github.com/swig/
[Haml]: https://github.com/hexojs/hexo-renderer-haml
[Jade]: https://github.com/hexojs/hexo-renderer-jade
[Jade]: https://github.com/hexojs/hexo-renderer-jade
[hexojs/site]: https://github.com/hexojs/site

0 comments on commit c3f4070

Please sign in to comment.