diff --git a/docs/cn/DATA-FILES.md b/docs/cn/DATA-FILES.md index 7443f04227..2aff8df629 100644 --- a/docs/cn/DATA-FILES.md +++ b/docs/cn/DATA-FILES.md @@ -1,5 +1,23 @@ -

ATTENTION!
-Contributors on Chinese docs needed!


-Need to translate from English docs to Chinese in this file, below.
-Any help wanted!
-Thank's a lot!
+# 使用 Hexo 数据文件进行主题配置 ([#328](https://github.com/iissnan/hexo-theme-next/issues/328)) + +目前,通过 pull 或下载新的 release 版本来更新 NexT 主题的体验并不平滑。当用户使用 `git pull` 更新 NexT 主题时经常需要解决冲突问题,而在手动下载 release 版本时也经常需要手动合并配置。 + +现在来说,NexT 推荐用户存储部分配置在站点的 `_config.yml` 中,而另一部分在主题的 `_config.yml` 中。这一方式固然可用,但也有一些缺点: +1. 配置项被分裂为两部分; +2. 用户难以弄清何处存放配置选项。 + +为了解决这一问题,NexT 将利用 Hexo 的[数据文件](https://hexo.io/docs/data-files.html)特性。因为数据文件是在 Hexo 3 中被引入,所以你需要更新至 Hexo 3.0 以后的版本来使用这一特性。 + +如果你仍然希望使用 Hexo 2.x,你依旧可以按老的方式进行配置。NexT 仍然兼容 Hexo 2.x(但可能会出现错误)。 + +## 带来的好处 + +使用这一特性,你现在可以将你的全部配置置于同一位置(`source/_data/next.yml`),并且不需要修改 `next/_config.yml`。如果在新的 release 中出现了任何新的选项,那么你只需要从 `next/_config.yml` 中将他们复制到 `source/_data/next.yml` 中并设置它们的值为你想要的选项。 + +## 如何使用这一特性 + +1. 请确认你的 Hexo 版本为 3.0 或更高。 +2. 在你站点的 `hexo/source/_data` 目录创建一个 `next.yml` 文件(如果 `_data` 目录不存在,请创建之)。 +3. 复制你站点的 `_config.yml` 和主题的 `_config.yml` 中的 NexT 配置项到`hexo/source/_data/next.yml`中。 +4. 使用 `--config source/_data/next.yml` 参数来启动服务器,生成或部署。\ + 例如:`hexo clean --config source/_data/next.yml && hexo g --config source/_data/next.yml`。 diff --git a/docs/cn/INSTALLATION.md b/docs/cn/INSTALLATION.md index 2cc2737990..b6f577ed0b 100644 --- a/docs/cn/INSTALLATION.md +++ b/docs/cn/INSTALLATION.md @@ -1,5 +1,134 @@ -

ATTENTION!
-Contributors on Chinese docs needed!


-Need to translate from English docs to Chinese in this file, below.
-Any help wanted!
-Thank's a lot!
+

安装

+ +

步骤 1 → 进入 Hexo 目录

+ +进入 **hexo 根**目录。这一目录中应当有 `node_modules`、`source`、`themes` 等若干子目录: + ```sh + $ cd hexo + $ ls + _config.yml node_modules package.json public scaffolds source themes + ``` + +

步骤 2 → 获取 NexT

+ +

从 GitHub 下载主题。
+为了下载这一主题,共有 3 种选项可选。你需要选择其中唯一一个方式

+ +### 选项 1:下载[最新 release 版本][releases-latest-url] + + 通常情况下请选择 **stable** 版本。推荐不熟悉的用户按此方式进行。 + + * 使用 [curl、tar 和 wget][curl-tar-wget-url] 安装: + + ```sh + $ mkdir themes/next + $ curl -s https://api.github.com/repos/theme-next/hexo-theme-next/releases/latest | grep tarball_url | cut -d '"' -f 4 | wget -i - -O- | tar -zx -C themes/next --strip-components=1 + ``` + 这种方式将**仅提供最新的 release 版本**(其中不附带 `.git` 目录)。\ + 因此,将来你将不可能通过 `git` 更新这一方式安装的主题。\ + 取而代之的,为了能不丢失你的自定义配置,你可以使用独立的配置文件(例如 [数据文件][docs-data-files-url])并下载最新版本到旧版本的目录中(或者下载到新的主题目录中并修改 Hexo 配置中的主题名)。 + +### 选项 2:下载 [tag 指向的 release 版本][releases-url] + + 在少数情况下将有所帮助,但这并非推荐方式。\ + 你必须指定一个版本:使用 [tags 列表][tags-url]中的任意 tag 替换 `v6.0.0`。 + + * 方式 1:使用 [curl 和 tar][curl-tar-url] 安装: + + ```sh + $ mkdir themes/next + $ curl -L https://api.github.com/repos/theme-next/hexo-theme-next/tarball/v6.0.0 | tar -zxv -C themes/next --strip-components=1 + ``` + 和上述的 `curl、tar 和 wget` 方法相同,但只会下载**指定的 release 版本**。 + + * 方式 2:使用 [git][git-url] 安装: + + ```sh + $ git clone --branch v6.0.0 https://github.com/theme-next/hexo-theme-next themes/next + ``` + 这一方式将为你下载**指定的 release 版本**(其中包含 `.git` 目录)。\ + 并且,你可以随时切换到任何已定义的版本号所对应的 tag 的版本。 + +### 选项 3:下载[最新 master 分支][download-latest-url] + + 可能**不稳定**,但包含最新的特性。推荐进阶用户和开发者按此方式进行。 + + * 方式 1:使用 [curl 和 tar][curl-tar-url] 安装: + + ```sh + $ mkdir themes/next + $ curl -L https://api.github.com/repos/theme-next/hexo-theme-next/tarball | tar -zxv -C themes/next --strip-components=1 + ``` + 和上述的 `curl、tar 和 wget` 方法相同,但只会下载**最新 master 分支版本**。\ + 在有些情况对开发者有所帮助。 + + * 方式 2:使用 [git][git-url] 安装: + + ```sh + $ git clone https://github.com/theme-next/hexo-theme-next themes/next + ``` + + 这一方式将为你下载**完整仓库**(其中包含 `.git` 目录)。\ + 你可以随时[使用 git 更新至最新版本][update-with-git-url]并切换至任何有 tag 标记的 release 版本、最新的 master 分支版本、甚至其他分支。\ + 在绝大多数情况下对用户和开发者友好。 + + 获取 tags 列表: + + ```sh + $ cd themes/next + $ git tag -l + … + v6.0.0 + v6.0.1 + v6.0.2 + ``` + + 例如,假设你想要切换到 `v6.0.1` 这一 [tag 指向的 release 版本][tags-url]。输入如下指令: + + ```sh + $ git checkout tags/v6.0.1 + Note: checking out 'tags/v6.0.1'. + … + HEAD now on 1f72f68... CSS: Remove global list-style setting of ul + ``` + + 然后,假设你想要切换回 [master 分支][commits-url],输入如下指令即可: + + ```sh + $ git checkout master + ``` + +

步骤 3 → 完成配置

+ +在 **hexo 根配置**文件 `_config.yml` 中设置你的主题: + +```yml +theme: next +``` + +

插件

+ +在 NexT 配置中你现在可以找到已经被移至外部仓库的依赖项。你可以在[组织主页](https://github.com/theme-next)中找到它们。 + +例如,假设你想要在你的站点中使用 `fancybox` 插件,请进入 NexT 配置文件,你会看到如下内容: + +```yml +# Fancybox +# Dependencies: https://github.com/theme-next/theme-next-fancybox +fancybox: false +``` + +将 `fancybox` 配置项打开,进入它上面的 Dependencies 链接以查看它的安装步骤。 + +[download-latest-url]: https://github.com/theme-next/hexo-theme-next/archive/master.zip +[releases-latest-url]: https://github.com/theme-next/hexo-theme-next/releases/latest +[releases-url]: https://github.com/theme-next/hexo-theme-next/releases +[tags-url]: https://github.com/theme-next/hexo-theme-next/tags +[commits-url]: https://github.com/theme-next/hexo-theme-next/commits/master + +[git-url]: http://lmgtfy.com/?q=linux+git+install +[curl-tar-url]: http://lmgtfy.com/?q=linux+curl+tar+install +[curl-tar-wget-url]: http://lmgtfy.com/?q=linux+curl+tar+wget+install + +[update-with-git-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/cn/README.md#update +[docs-data-files-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/cn/DATA-FILES.md diff --git a/docs/cn/README.md b/docs/cn/README.md index 6c93aed239..5ebc787f55 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -1,5 +1,86 @@ -

ATTENTION!
-Contributors on Chinese docs needed!


-Need to translate from English docs to Chinese in this file, below.
-Any help wanted!
-Thank's a lot!
+ +#
e x T
+ +

«NexT» 是一款风格优雅的高质量 Hexo 主题,自点点滴滴中用爱雕琢而成。

+ +[![gitter-image]][gitter-url] +[![mnt-image]][commits-url] +[![travis-image]][travis-url] +[![rel-image]][releases-url] +[![hexo-image]][hexo-url] +[![lic-image]][lic-url] + +* :triangular_flag_on_post: 推荐 Markdown 编辑器:HexoEditor + +## 即时预览 + +* :heart_decoration: Muse 主题: [XiaMo](https://notes.wanghao.work) | [OAwan](https://oawan.me) | [Hui Wang](http://hui-wang.info) +* :six_pointed_star: Mist 主题: [Jeff](https://blog.zzbd.org) | [uchuhimo](http://uchuhimo.me) | [xirong](http://www.ixirong.com) +* :pisces: Pisces 主题: [Vi](http://notes.iissnan.com) | [Acris](https://acris.me) | [Rainy](https://rainylog.com) +* :gemini: Gemini 主题: [Ivan.Nginx](https://almostover.ru) | [Alynx](http://sh.alynx.xyz) | [Raincal](https://raincal.top) + +更多 «NexT» 的例子参见[这里](https://github.com/iissnan/hexo-theme-next/issues/119)。 + +## 安装 + +最简单的安装方式是直接克隆整个仓库: + + ```sh + $ cd hexo + $ git clone https://github.com/theme-next/hexo-theme-next themes/next + ``` + +此外,如果你想要使用其他方式,你也可以参见[详细安装步骤][docs-installation-url]。 + +## 更新 + +你可以通过如下命令更新到最新的 master 分支: + +```sh +$ cd themes/next +$ git pull +``` + +如果你在此过程中收到了任何错误报告 (例如 **«Commit your changes or stash them before you can merge»**),我们推荐你使用 [Hexo 数据文件][docs-data-files-url]特性。\ +然而你也可以通过提交(`Commit`)、贮藏(`Stash`)或忽视(`Discard`)本地更改以绕过这种更新错误。具体方法请参考[这里](https://stackoverflow.com/a/15745424/5861495)。 + +如果你想要从 v5.1.x 更新到 v6.0.x,阅读[这篇文档][docs-update-5-1-x-url]。 + +## 已知问题 + +对于仍然遇到 **«[Error: Cannot find module 'hexo-util'](https://github.com/iissnan/hexo-theme-next/issues/1490)»** 这一错误的用户,请检查你的 NPM 版本。 + +* `> 3`:仍然出现错误吗?请删除 `node_modules` 目录并通过 `npm install` 重新安装。 +* `< 3`:请通过 `npm install --save-dev hexo-util` 将 `hexo-util` 依赖手动添加至你的站点依赖包中。 + +## 贡献你的代码 + +我们欢迎你贡献出你的一份力量,你可以随时提交 issue 或 fork 本仓库。静候你的 pull request。 + +[browser-image]: https://img.shields.io/badge/browser-%20chrome%20%7C%20firefox%20%7C%20opera%20%7C%20safari%20%7C%20ie%20%3E%3D%209-lightgrey.svg +[browser-url]: https://www.browserstack.com + +[gitter-image]: https://badges.gitter.im/Join%20Chat.svg +[gitter-url]: https://gitter.im/theme-next + +[travis-image]: https://travis-ci.org/theme-next/hexo-theme-next.svg?branch=master +[travis-url]: https://travis-ci.org/theme-next/hexo-theme-next?branch=master "Travis CI" + +[hexo-image]: https://img.shields.io/badge/hexo-%3E%3D%203.0-blue.svg +[hexo-url]: http://hexo.io + +[lic-image]: https://img.shields.io/badge/license-%20AGPL-blue.svg +[lic-url]: https://github.com/theme-next/hexo-theme-next/blob/master/LICENSE.md + +[rel-image]: https://img.shields.io/github/release/theme-next/hexo-theme-next.svg +[mnt-image]: https://img.shields.io/maintenance/yes/2018.svg + +[download-latest-url]: https://github.com/theme-next/hexo-theme-next/archive/master.zip +[releases-latest-url]: https://github.com/theme-next/hexo-theme-next/releases/latest +[releases-url]: https://github.com/theme-next/hexo-theme-next/releases +[tags-url]: https://github.com/theme-next/hexo-theme-next/tags +[commits-url]: https://github.com/theme-next/hexo-theme-next/commits/master + +[docs-installation-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/cn/INSTALLATION.md +[docs-data-files-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/cn/DATA-FILES.md +[docs-update-5-1-x-url]: https://github.com/theme-next/hexo-theme-next/blob/master/docs/cn/UPDATE-FROM-5.1.X.md diff --git a/docs/cn/UPDATE-FROM-5.1.X.md b/docs/cn/UPDATE-FROM-5.1.X.md new file mode 100644 index 0000000000..8b561a094e --- /dev/null +++ b/docs/cn/UPDATE-FROM-5.1.X.md @@ -0,0 +1,29 @@ +

从 NexT v5.1.x 更新

+ +在 5.1.x 版本和 6.0.x 版本之间没有很大的革命性改进。主版本号变更至 6 主要是因为: + +1. 主仓库已从 [iissnan 名下](https://github.com/iissnan/hexo-theme-next) 迁移至 [theme-next](https://github.com/theme-next) 组织。 +2. `next/source/lib` 目录下的绝大多数库被移出到了 [NexT 组织的外部仓库](https://github.com/theme-next)中。 +3. 第三方插件 [`hexo-wordcount`](https://github.com/willin/hexo-wordcount) 被 [`hexo-symbols-count-time`](https://github.com/theme-next/hexo-symbols-count-time) 所取代,因为 `hexo-symbols-count-time` 没有任何外部 nodejs 依赖、也没有会导致生成站点时的性能问题 [language filter](https://github.com/willin/hexo-wordcount/issues/7)。 + +推荐通过如下步骤从 v5 升级到 v6: + +1. 并不修改原有的 `next` 目录,而只是复制部分 NexT 文件: + 1. `config.yml` 或 `next.yml`(如果你使用了[数据文件](DATA-FILES.md))。 + 2. 自定义的 CSS 配置,它们应在 `next/source/css/_custom/*` 和 `next/source/css/_variables/*` 中。 + 3. 自定义的排布配置,它们应在 `next/layout/_custom/*` 中。 + 4. 任何其它可能的附加自定义内容;为了定位它们,你可以通过某些工具在仓库间比较。例如,使用 [Beyond Compare](https://github.com/ivan-nginx/beyond-compare)。 +2. 克隆新的 v6.x 仓库到任一异于 `next` 的目录(如 `next-reloaded`): + ```sh + $ git clone https://github.com/theme-next/hexo-theme-next themes/next-reloaded + ``` + 如此,你可以在不修改原有的 NexT v5.1.x 目录的同时使用 `next-reloaded` 目录中的新版本主题。 +3. 在 Hexo 的主配置文件中设置主题: + ```yml + ... + theme: next-reloaded + ... + ``` + 如此,你的 `next-reloaded` 主题将在生成站点时被加载。如果你遇到了任何错误、或只是不喜欢这一新版本,你可以随时切换回旧的 v5.1.x 版本。 + +关于第三方库的启用,参见[这里](https://github.com/theme-next/hexo-theme-next/blob/master/docs/INSTALLATION.md#plugins)。 diff --git a/languages/zh-Hans.yml b/languages/zh-Hans.yml index b016ce9e0b..022e00e131 100644 --- a/languages/zh-Hans.yml +++ b/languages/zh-Hans.yml @@ -33,8 +33,8 @@ post: visitors: 阅读次数 wordcount: 字数统计 min2read: 阅读时长 - totalcount: Site words total count - totaltime: Site reading time + totalcount: 站点总字数 + totaltime: 站点总阅读次数 copyright: author: 本文作者 link: 本文链接