Move docs to website

This commit is contained in:
Mimi 2020-05-12 00:18:47 +08:00
parent 009a8b6b22
commit d3d4bd56bb
18 changed files with 9 additions and 1617 deletions

View File

@ -123,9 +123,9 @@ Also, we welcome Issue or PR to our [official-plugins][official-plugins-url].
<sub>Crowdin allows us to translate conveniently the documentation.</sub>
</p>
[docs-installation-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/INSTALLATION.md
[docs-data-files-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/DATA-FILES.md
[docs-update-5-1-x-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/UPDATE-FROM-5.1.X.md
[docs-installation-url]: https://theme-next.js.org/docs/getting-started/installation.html
[docs-data-files-url]: https://theme-next.js.org/docs/getting-started/configuration.html
[docs-update-5-1-x-url]: https://theme-next.js.org/docs/getting-started/update-from-v5.html
[t-chat-url]: https://t.me/theme_next
[gitter-url]: https://gitter.im/theme-next

View File

@ -1,82 +0,0 @@
<h1 align="center">Algolia Search</h1>
NexT provides Algolia search plugin for index your hexo website content. To use this feature, make sure that the version of NexT you are using is after the v5.1.0 release. What you should note here is that only turn on `enable` of `algolia_search` in `next/_config.yml` cannot let you use the algolia search correctly, you need to install corresponding [Hexo Algolia](https://github.com/oncletom/hexo-algolia) plugin to seach your website with Algolia. Follow the steps described below to complete the installation of Algolia search.
1. Register at [Algolia](https://www.algolia.com/), you can log in directly using GitHub or Google Account. Upon Customers initial sign-up for an Account, Customer will have a free, fourteen (14) day evaluation period (the “Evaluation Period”) for the Algolia Services commencing on the Effective Date, subject to the limitations on Algolias website. After that, Algolia offers a free, branded version for up to 10k records and 100k operations per month.
1. If a tutorial pops up, you can skip it. Go straight to create an `Index` which will be used later.
![](https://user-images.githubusercontent.com/16272760/73673892-68a29b00-46ea-11ea-90c5-916b4b11fc7a.png)
1. Go to the `API Keys` page and find your credentials. You will need the `Application ID` and the `Search-only API key` in the following sections. The `Admin API key` need to keep confidential. Never store your Admin API Key as apiKey in the` _config.yml` file: it would give full control of your Algolia index to others and you don't want to face the consequences.
![](https://user-images.githubusercontent.com/16272760/73673895-693b3180-46ea-11ea-8f50-8bae850b50d0.png)
1. In your site's `_config.yml`, add the following configuration and replace the `applicationID` & `apiKey` & `indexName` with corresponding fields obtained at Algolia.
```yml
algolia:
applicationID: 'Application ID'
apiKey: 'Search-only API key'
indexName: 'indexName'
chunkSize: 5000
```
1. In the `API Keys` page, click the `All API Keys` button to switch to the corresponding tab. Then click the `New API Key` button to activate a pop-up box where you can setup authorizations and restrictions with a great level of precision. Enter `addObject`, `deleteObject`, `listIndexes`, `deleteIndex` features in ACL permissions that will be allowed for the given API key. And then click the `Create` button. Copy this newly created key to the clipboard, we call it a `High-privilege API key`.
![](https://user-images.githubusercontent.com/16272760/73673902-6b04f500-46ea-11ea-9c80-4e5c5002e07b.png)
![](https://user-images.githubusercontent.com/16272760/73673905-6b9d8b80-46ea-11ea-9e01-702ec2a8a297.png)
1. Algolia requires users to upload their search index data either manually or via provided APIs. Install and configure [Hexo Algolia](https://github.com/oncletom/hexo-algolia) in your Hexo directory. This plugin will index your site and upload selected data to Algolia.
```
$ cd hexo
$ npm install hexo-algolia
```
1. Run the following command to upload index data, keep a weather eye out the output of the command.
```
$ export HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # Use Git Bash
# set HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # Use Windows command line
$ hexo clean
$ hexo algolia
```
![](http://theme-next.iissnan.com/uploads/algolia/algolia-step-4.png)
1. In `next/_config.yml`, turn on `enable` of `algolia_search`. At the same time, you need to **turn off other search plugins** like Local Search. You can also adjust the text in `labels` according to your needs.
```yml
# Algolia Search
algolia_search:
enable: true
hits:
per_page: 10
labels:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}"
hits_stats: "${hits} results found in ${time} ms"
```
1. If you want to use a different version from CDN, please follow the instructions below.
You need to **set vendors** in NexT `_config.yml` file:
```yml
vendors:
...
# Algolia Search
# algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js
# instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js
algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js
instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js
...
```
<h2 align="center">Known Issues</h2>
1. The latest version of the [Hexo-Algolia](https://github.com/oncletom/hexo-algolia) plugin removes the content indexing feature, given Algolia's free account limitation.
1. The [Hexo-Algoliasearch](https://github.com/LouisBarranqueiro/hexo-algoliasearch) plugin provides content indexing functionality, but requires the replacement of keywords in the NEXT theme. The same problem exists with `Record Too Big` for Algolia's free account.
- Replace all `applicationID` in `source/js/algolia-search.js` with `appId`
- Replace all `applicationID` in `layout/_partials/head/head.njk` with `appId`

View File

@ -1,39 +0,0 @@
<h1 align="center">Configuration Files</h1>
How to configure Hexo and NexT? The traditional approach is to store some options in site's `/_config.yml` and other options in theme's `/themes/next/_config.yml`. This approach is applicable, but it is not smooth to update NexT theme from pulling or downloading new releases. It is quite often running into conflict status when updating NexT theme via `git pull`, or need to merge configurations manually when upgrading to new releases. For the new version of Hexo, the theme can be installed through npm; it is also difficult to directly modify the theme configuration file in `node_modules`.
In order to resolve this issue, Hexo provides the following solutions. Please choose only one of them and resume next steps.
## `theme_config`
With this way, all your configurations locate in main Hexo config file (`/_config.yml`), you don't need to touch `/themes/next/_config.yml` or create any new files. But you must preserve double spaces indents within `theme_config` option.
If there are any new options in new releases, you just need to copy those options from `/themes/next/_config.yml`, paste into `/_config.yml` and set their values to whatever you want.
### Usage
Copy needed NexT theme options from theme's `/themes/next/_config.yml` into `/_config.yml`, then\
1. Move all this settings to the right with two spaces (in Visual Studio Code: select all strings, <kbd>CTRL</kbd> + <kbd>]</kbd>).\
2. Add `theme_config:` parameter above all this settings.
## `_config.[name].yml`
With this way, all your configurations locate in config file `/_config.[name].yml`. Replace `[name]` with the value of `theme` option in Hexo config file (`/_config.yml`), e.g. `next`.
If there are any new options in new releases, you just need to copy those options from `/themes/next/_config.yml`, paste into this config file and set their values to whatever you want.
### Usage
1. Please ensure you are using Hexo 4.3 (or above).
2. Create a config file in site's root directory, e.g. `_config.next.yml`.
3. Copy needed NexT theme options from theme's `/themes/next/_config.yml` into this config file.
## `next.yml`
Older versions of NexT theme also provide another configuration method, which is to place the theme configuration in the `/source/_data/next.yml` file. This method is deprecated, please use `_config.[name].yml` instead. If the `/source/_data/next.yml` file exists, move it to the Hexo root directory and rename it to `_config.next.yml`.
## Useful links
* [Hexo Configuration](https://hexo.io/docs/configuration.html)
* [Hexo Pull #757](https://github.com/hexojs/hexo/pull/757)
* [Hexo Pull #4120](https://github.com/hexojs/hexo/pull/4120)

View File

@ -1,121 +0,0 @@
<h1 align="center">Installation</h1>
<h2 align="center">Step 1 &rarr; Go to Hexo dir</h2>
Change dir to **Hexo root** directory. There must be `node_modules`, `source`, `themes` and other directories:
```sh
$ cd hexo
$ ls
_config.yml node_modules package.json public scaffolds source themes
```
<h2 align="center">Step 2 &rarr; Get NexT</h2>
<p align="center">Download theme from GitHub.<br>
There are <b>3 options</b> to do it, need to <b>choose only one</b> of them.</p>
### Option 1: Download [latest release version][releases-latest-url]
At most cases **stable**. Recommended for beginners.
* Install with [curl & tar & wget][curl-tar-wget-url]:
```sh
$ mkdir themes/next
$ curl -s https://api.github.com/repos/next-theme/hexo-theme-next/releases/latest | grep tarball_url | cut -d '"' -f 4 | wget -i - -O- | tar -zx -C themes/next --strip-components=1
```
This variant will give to you **only latest release version** (without `.git` directory inside).\
So, there is impossible to update this version with `git` later.\
Instead you always can use separate configuration (e.g. [data-files][docs-data-files-url]) and download new version inside old directory (or create new directory and redefine `theme` in Hexo config), without losing your old configuration.
### Option 2: Download [tagged release version][releases-url]
In rare cases useful, but not recommended.\
You must define version. Replace `v6.0.0` with any version from [tags list][tags-url].
* Variant 1: Install with [curl & tar][curl-tar-url]:
```sh
$ mkdir themes/next
$ curl -L https://api.github.com/repos/next-theme/hexo-theme-next/tarball/v6.0.0 | tar -zxv -C themes/next --strip-components=1
```
Same as above under `curl & tar & wget` variant, but will download **only concrete version**.
* Variant 2: Install with [git][git-url]:
```sh
$ git clone --branch v6.0.0 https://github.com/next-theme/hexo-theme-next themes/next
```
This variant will give to you the **defined release version** (with `.git` directory inside).\
And in any time you can switch to any tagged release, but with limit to defined version.
### Option 3: Download [latest master branch][download-latest-url]
May be **unstable**, but includes latest features. Recommended for advanced users and for developers.
* Variant 1: Install with [curl & tar][curl-tar-url]:
```sh
$ mkdir themes/next
$ curl -L https://api.github.com/repos/next-theme/hexo-theme-next/tarball | tar -zxv -C themes/next --strip-components=1
```
Same as above under `curl & tar & wget` variant, but will download **only latest master branch version**.\
At some cases useful for developers.
* Variant 2: Install with [git][git-url]:
```sh
$ git clone https://github.com/next-theme/hexo-theme-next themes/next
```
This variant will give to you the **whole repository** (with `.git` directory inside).\
And in any time you can [update current version with git][update-with-git-url] and switch to any tagged release or on latest master or any other branch.\
At most cases useful as for users and for developers.
Get tags list:
```sh
$ cd themes/next
$ git tag -l
v6.0.0
v6.0.1
v6.0.2
```
For example, you want to switch on `v6.0.1` [tagged release version][tags-url]. Input the following command:
```sh
$ git checkout tags/v6.0.1
Note: checking out 'tags/v6.0.1'.
HEAD is now at da9cdd2... Release v6.0.1
```
And if you want to switch back on [master branch][commits-url], input this command:
```sh
$ git checkout master
```
<h2 align="center">Step 3 &rarr; Set it up</h2>
Set theme in main **Hexo root config** `_config.yml` file:
```yml
theme: next
```
[download-latest-url]: https://github.com/next-theme/hexo-theme-next/archive/master.zip
[releases-latest-url]: https://github.com/next-theme/hexo-theme-next/releases/latest
[releases-url]: https://github.com/next-theme/hexo-theme-next/releases
[tags-url]: https://github.com/next-theme/hexo-theme-next/tags
[commits-url]: https://github.com/next-theme/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/next-theme/hexo-theme-next/blob/master/README.md#update
[docs-data-files-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/DATA-FILES.md

View File

@ -1,178 +0,0 @@
<h1 align="center">Fix LeanCloud Counter Plugin Security Vulnerability</h1>
Before you make the config, please upgrade your NexT version to v6.0.6 or greater.
Please note the difference between **site config file** and **theme config file**
---
# Sign up to LeanCloud and create an app
- Go to LeanCloud website [leancloud.app](https://leancloud.app) and sign up to LeanCloud. Then login.
- Click `1` to enter the console:
![1](https://lc-cqha0xyi.cn-n1.lcfile.com/fc0c048a1e25dc3d10aa.jpg)
- Then click `1` to create an app:
![2](https://lc-cqha0xyi.cn-n1.lcfile.com/33a56b754753a5d34b01.jpg)
- Type your app name in `1` in the pop up window(eg. "test"), then choose `2`, which means developer's plan, and then click `3` to create the app:
![3](https://lc-cqha0xyi.cn-n1.lcfile.com/649ccfc6f12015d1eefb.jpg)
# Create Counter class and enable plugin in NexT
- Click `1` (app name) to enter the app manage page:
![4](https://lc-cqha0xyi.cn-n1.lcfile.com/d0889df29841661e0b9e.jpg)
- then click `1` to create a class for counter:
![5](https://lc-cqha0xyi.cn-n1.lcfile.com/b0fbc81bd6c19fa09a46.jpg)
- Type `Counter` in the pop up window in `1`, check `2`, then click `3`:
![6](https://lc-cqha0xyi.cn-n1.lcfile.com/ae6154d6a55f02f11ebf.jpg)
- Click `1` to enter the app setting, then click `2`:
![8](https://lc-cqha0xyi.cn-n1.lcfile.com/9501a6372918dd9a8a92.jpg)
- Paste `App ID` and `App Key` to **theme config file** `_config.yml` like this:
```yml
leancloud_visitors:
enable: true
app_id: # <your app id>
app_key: # <your app key>
# Required for apps from CN region
server_url: # <your server url>
# Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security
security: true
```
- Set domain whitelist: Click `1`, then type your domain into `2` (**protocol, domain and port should be exactly the same**):
![9](https://lc-cqha0xyi.cn-n1.lcfile.com/0e537cc4bec2e185201d.jpg)
# Deploy web engine to avoid your data being changed illegally
- Click `1 -> 2 -> 3` by order
![10](https://lc-cqha0xyi.cn-n1.lcfile.com/d7056dfeeef7c5d66318.jpg)
- Click `1`:
![11](https://lc-cqha0xyi.cn-n1.lcfile.com/2737841bbc2bdd572ae0.jpg)
- In the pop up window, click `1` to choose type `Hook`, then choose`beforeUpdate` in `2`, choose `Counter` in `3`. Paste code below into `4`, then click `5` to save it:
```javascript
var query = new AV.Query("Counter");
if (request.object.updatedKeys.includes('time')) {
return query.get(request.object.id).then(function (obj) {
if (obj.get("time") > request.object.get("time")) {
throw new AV.Cloud.Error('Invalid update!');
}
return request.object.save();
});
}
```
![12](https://lc-cqha0xyi.cn-n1.lcfile.com/a8e13418ed1d9405315b.jpg)
- Click `1` to deploy after the message in the red rect shows up:
![13](https://lc-cqha0xyi.cn-n1.lcfile.com/ca56bf2e5fc2a1343565.jpg)
- Click `1` in the pop up
![14](https://lc-cqha0xyi.cn-n1.lcfile.com/17548c13b3b23c71d845.jpg)
- Click `1` to close the pop up window after the message in the red rect shows up:
![15](https://lc-cqha0xyi.cn-n1.lcfile.com/d2f50de6cefea9fd0ed3.jpg)
# Set access control for your database
- Open **theme config file** `_config.yml`, set `leancloud_visitors: security` to `true`:
```yml
leancloud_visitors:
enable: true
app_id: # <your app id>
app_key: # <your app key>
# Required for apps from CN region
server_url: # <your server url>
# Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security
security: true
```
- Open cmd then switch to **root path of site**, type commands to install `hexo-leancloud-counter-security` plugin:
```
npm install hexo-leancloud-counter-security
```
- Open **site config file** `_config.yml`, add those config:
```yml
leancloud_counter_security:
enable_sync: true
app_id: <your app id>
app_key: <your app key>
username:
password:
```
- Type command:
```
hexo lc-counter register <username> <password>
```
or
```
hexo lc-counter r <username> <password>
```
Change `<username>` and `<password>` to your own username and password (no need to be the same as leancloud account). They will be used in the hexo deploying.
- Open **site config file** `_config.yml`, change `<username>` and `<password>`to those you set above:
```yml
leancloud_counter_security:
enable_sync: true
app_id: <your app id>
app_key: <your app key>
username: <your username> # will be asked while deploying if be left blank
password: <your password> # recommend to leave it blank for security, will be asked while deploying if be left blank
```
- Add the deployer in the `deploy` of **site config file** `_config.yml`:
```yml
deploy:
- type: git
repo: // your repo
...
- type: leancloud_counter_security_sync
```
- Return to the LeanCloud console. Click `1 -> 2`, check if there is a record added in the `_User` (the img below is using username "admin" for example):
![16](https://lc-cqha0xyi.cn-n1.lcfile.com/99faa5a0e7160e66d506.jpg)
- Click `1 -> 2 -> 3` by order:
![17](https://lc-cqha0xyi.cn-n1.lcfile.com/b72a9e64579f5b71749d.jpg)
- <del>Click `1` (add_fields), then choose `2`:</del> Do as below "create" setting(choose the user you create):
![18](https://lc-cqha0xyi.cn-n1.lcfile.com/14a8cb37062693d768ad.jpg)
- click `1` (create), then choose `2`, type the username in `3`, then click `4 -> 5`:
![19](https://lc-cqha0xyi.cn-n1.lcfile.com/d91714cfd703ef42b94c.jpg)
Now your page should be similar to this img after finishing the step.
![20](https://lc-cqha0xyi.cn-n1.lcfile.com/c05e7ec9218820baf412.jpg)
- Click `1` (delete), then choose `2`:
![21](https://lc-cqha0xyi.cn-n1.lcfile.com/c37b6e20726cfb1d3197.jpg)
Now the bug is fixed.
---
See detailed version here: https://leaferx.online/2018/03/16/lc-security-en/

View File

@ -1,245 +0,0 @@
<h1 align="center">Math Equations</h1>
NexT provides two render engines for displaying Math Equations.
If you choose to use this feature, you don't need to manually import any JS or CSS. You just need to choose a render engine and turn on `enable` for it (located in `next/_config.yml`).
Notice: only turning on `enable` **cannot let you see the displayed equations correctly**, you need to install the **corresponding Hexo Renderer** to fully support the display of Math Equations. The corresponding Hexo Renderer per engine will be provided below.
<h2 align="center">Provided Render Engine</h2>
For now, NexT provides two Render Engines: [MathJax](https://www.mathjax.org/) and [Katex](https://khan.github.io/KaTeX/).
### MathJax
If you use MathJax to render Math Equations, you need to use one of them: [hexo-renderer-pandoc](https://github.com/wzpan/hexo-renderer-pandoc) or [hexo-renderer-kramed](https://github.com/sun11/hexo-renderer-kramed) (Not recommended) as the renderer for Markdown.
Firstly, you need to uninstall the original renderer `hexo-renderer-marked`, and install **one of the renderer above**:
```sh
npm uninstall hexo-renderer-marked
npm install hexo-renderer-pandoc # or hexo-renderer-kramed
```
Secondly, in `next/_config.yml`, turn on `enable` of `mathjax`.
```yml
math:
...
mathjax:
enable: true
```
Finally, run standard Hexo generate, deploy process or start the server:
```sh
hexo clean && hexo g -d
# or hexo clean && hexo s
```
#### Numbering and referring equations in MathJax
In the new version of NexT, we have added feature to automatically number equations and to refer to equations. We briefly describe how to use this feature below.
In general, to make the automatic equation numbering work, you have to wrap your LaTeX equations in `equation` environment. Using the plain old style (i.e., wrap an equation with two dollar signs in each side) will not work. How to refer to an equation? Just give a `\label{}` tag and then in your later text, use `\ref{}` or `\eqref{}` to refer it. Using `\eqref{}` is preferred since if you use `\ref{}`, there are no parentheses around the equation number. Below are some of the common scenarios for equation numbering.
For simple equations, use the following form to give a tag,
```latex
$$\begin{equation}\label{eq1}
e=mc^2
\end{equation}$$
```
Then, you can refer to this equation in your text easily by using something like
```
the famous matter-energy equation $\eqref{eq1}$ proposed by Einstein ...
```
For multi-line equations, inside the `equation` environment, you can use the `aligned` environment to split it into multiple lines:
```latex
$$\begin{equation}\label{eq2}
\begin{aligned}
a &= b + c \\
&= d + e + f + g \\
&= h + i
\end{aligned}
\end{equation}$$
```
We can use `align` environment to align multiple equations. Each of these equations will get its own numbers.
```
$$\begin{align}
a &= b + c \label{eq3} \\
x &= yz \label{eq4}\\
l &= m - n \label{eq5}
\end{align}$$
```
In the `align` environment, if you do not want to number one or some equations, just [use `\nonumber`](https://tex.stackexchange.com/questions/17528/show-equation-number-only-once-in-align-environment) right behind these equations. Like the following:
```latex
$$\begin{align}
-4 + 5x &= 2+y \nonumber \\
w+2 &= -1+w \\
ab &= cb
\end{align}$$
```
Sometimes, you want to use more “exotic” style to refer your equation. You can use `\tag{}` to achieve this. For example:
```latex
$$x+1\over\sqrt{1-x^2} \tag{i}\label{eq_tag}$$
```
For more information, you can visit the [official MathJax documentation on equation numbering](https://docs.mathjax.org/en/latest/input/tex/eqnumbers.html). You can also visit this [post](https://theme-next.js.org/docs/third-party-services/math-equations) for more details.
### Katex
The Katex engine is a **much faster** math render engine compared to MathJax. And it could survive without JavaScript.
But, what Katex supports is not as full as MathJax. You could check it from the Useful Links below.
If you use Katex to render Math Equations, you need to use **only one of those renderer**: [hexo-renderer-markdown-it-plus](https://github.com/CHENXCHEN/hexo-renderer-markdown-it-plus) or [hexo-renderer-markdown-it](https://github.com/hexojs/hexo-renderer-markdown-it).
Firstly, you need to uninstall the original renderer `hexo-renderer-marked`, and **install one of selected above**.
```sh
npm uninstall hexo-renderer-marked
npm install hexo-renderer-markdown-it-plus
# or hexo-renderer-markdown-it
```
Secondly, in `next/_config.yml`, turn on `enable` option of `katex`.
```yml
math:
...
katex:
enable: true
```
Finally, run the standard Hexo generate, deploy process or start the server:
```sh
hexo clean && hexo g -d
# or hexo clean && hexo s
```
#### If you use hexo-renderer-markdown-it
If you use `hexo-renderer-markdown-it`you also need to add `markdown-it-katex` as its plugin
```
npm install markdown-it-katex
```
And then in `hexo/_config.yml` you need to add `markdown-it-katex` as a plugin for `hexo-renderer-markdown-it`:
```yml
# config of hexo-renderer-markdown-it
markdown:
render:
html: true
xhtmlOut: false
breaks: true
linkify: true
typographer: true
quotes: '“”‘’'
plugins:
- markdown-it-katex
```
#### Known Bugs
1. Firstly, please check [Common Issues](https://github.com/Khan/KaTeX#common-issues) of Katex.
2. Displayed Math (i.e. `$$...$$`) needs to started with new clear line.\
In other words: you must not have any characters (except of whitespaces) **before the opening `$$` and after the ending `$$`** ([comment #32](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-357489509)).
3. Don't support Unicode ([comment #32](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-357489509)).
4. Inline Math (..`$...$`) must not have white spaces **after the opening `$` and before the ending `$`** ([comment #32](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-357489509)).
5. If you use math in Heading (i.e. `## Heading`).\
Then in corresponding TOC item it will show the related LaTex code 3 times ([comment #32](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-359018694)).
6. If you use math in your post's title, it will not be rendered ([comment #32](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-359142879)).
We currently use Katex 0.11.1, some of those bugs might be caused by the outdated version of Katex we use.
But, as what is described in the beginning, the render of Math Equations relies on Hexo Renderer. Currently, Katex-related renderers only support Katex version until 0.11.1.
We will continuously monitor the updates of corresponding renderers, if there is a renderer which supports newer version of Katex, we will update the Katex we use.
### Useful Links
* [Speed test between Katex and MathJax](https://www.intmath.com/cg5/katex-mathjax-comparison.php)
* [Function support by Katex](https://khan.github.io/KaTeX/function-support.html)
<h2 align="center">Configuration Specifications</h2>
ATTENTION! When you edit those configs, **don't change indentation!**
Currently, all NexT config use **2 spaces indents**.
If your content of config is put just directly after the config name, then a space is needed between the colon and the config content (i.e. `enable: true`)
```yml
# Math Formulas Render Support
math:
# Default (true) will load mathjax / katex script on demand.
# That is it only render those page which has `mathjax: true` in Front-matter.
# If you set it to false, it will load mathjax / katex srcipt EVERY PAGE.
per_page: true
# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support.
mathjax:
enable: true
# See: https://mhchem.github.io/MathJax-mhchem/
mhchem: false
# hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugin) required for full Katex support.
katex:
enable: false
# See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex
copy_tex: false
```
### `per_page`
`true` or `false`, default is `true`.
This option is to control whether to render Math Equations every page.
The behavior of default (`true`) is to render Math Equations **on demand**.
It will only render those posts which have `mathjax: true` in their Front-matter.
For example:
```md
<!-- This post will render the Math Equations -->
---
title: 'Will Render Math'
mathjax: true
---
....
```
```md
<!-- This post will NOT render the Math Equations -->
---
title: 'Not Render Math'
mathjax: false
---
....
```
```md
<!-- This post will NOT render the Math Equations either -->
---
title: 'Not Render Math Either'
---
....
```
When you set it to `false`, the math will be rendered on **EVERY PAGE**.

View File

@ -1,29 +0,0 @@
<h1 align="center">Update from NexT v5.1.x</h1>
NexT version 5 works fine with Hexo 3, but for frequent users, you maybe need to upgrade version 5 to 7 to get features and supports in new [Theme-Next](https://github.com/next-theme/hexo-theme-next) repository.
There are no hard breaking changes between 5.1.x and the latest version. It's change major version to 7 because:
1. Main repo was rebased from [iissnan's](https://github.com/iissnan/hexo-theme-next) profile to [theme-next](https://github.com/theme-next) organization.
2. Most libraries under the `next/source/lib` directory was moved out to [external repos under NexT organization](https://github.com/theme-next).
3. 3rd-party plugin [`hexo-wordcount`](https://github.com/willin/hexo-wordcount) was replaced by [`hexo-symbols-count-time`](https://github.com/next-theme/hexo-symbols-count-time) because `hexo-symbols-count-time` no have any external Node.js dependencies, no have [language filter](https://github.com/willin/hexo-wordcount/issues/7) which causes better performance on speed at site generation.
So, we suggest to update from version 5 to version 7 in this way:
1. You don't touch old `next` dir and just do some copies of NexT files:\
1.1. `_config.yml` or `next.yml` (if you used [data-files](DATA-FILES.md)).\
1.2. Custom CSS styles what placed in `next/source/css/_custom/*` and `next/source/css/_variables/*` directories.\
1.3. Custom layout styles what placed in `next/layout/_custom/*`.\
1.4. Any another possible custom additions which can be finded by compare tools between repos.
2. Clone new repo to any another directory instead of `next`. For example, in `next-reloaded` directory: `git clone https://github.com/next-theme/hexo-theme-next themes/next-reloaded`. So, you don't touch your old NexT 5.1.x directory and can work with new `next-reloaded` dir.
3. Go to Hexo main config and set theme parameter: `theme: next-reloaded`. So, your `next-reloaded` directory must loading with your generation. If you may see any bugs or you simply not like this version, you anytime can switch for 5.1.x version back.
4. Update language configuration (For Chinese)
Since v6.0.3, `zh-Hans` has been renamed to `zh-CN`: https://github.com/next-theme/hexo-theme-next/releases/tag/v6.0.3
Users upgrading to v6.0.3 and later need to explicitly modify the `language` configuration in the Hexo main config file `_config.yml`, otherwise the language display is incorrect.
5. Update Hexo and Hexo plugin
If after completing the above steps, an error occurs when executing `hexo s` or` hexo g`, it means that there may be a conflict between the old version of Hexo / Hexo plugin and the new version of the theme NexT. We recommend upgrading Hexo to versions 4.0 and higher and upgrading Hexo plugins to the latest version. You can run `npm outdated` to see all the upgradeable plugins.
And how to enable 3rd-party libraries see [here](https://github.com/next-theme/hexo-theme-next/blob/master/docs/INSTALLATION.md#plugins).

View File

@ -1,61 +0,0 @@
<h1 align="center">Дата Файлы</h1>
Обновление темы NexT через пулы проходит не слишком гладко. Часто происходит конфликтная ситуация при обновлении по команде `git pull`, хотя её и можно обойти, если смерджить настройки в файле конфигурации вручную.
На данный момент, пользователи хранят одни настройки в корневом `_config.yml` (Hexo), а другие настройки в конфиге темы `_config.yml` (NexT). И всё вроде бы ничего, но имеются некоторые недостатки:
1. Конфигурация разделяется на две части.
2. Пользователи могут запутаться, в каком файле какие должны быть настройки.
Во избежании проблемы, NexT предлагает два варианта.
<h2 align="center">Способ 1: Hexo-Путь</h2>
Используя этот способ, вся конфигурация будет раположена в корневом конфиге hexo (`/_config.yml`), благодаря чему нет необходимости изменять оригинальный конфиг темы (`/themes/next/_config.yml`) или создавать какие-либо новые файлы. Но в этом случае необходимо сохранять двойные отступы внутри `theme_config` параметра.
Если в новых версиях появятся какие-то новые настройки, нужно просто скопировать эти настройки из оригинального `next/_config.yml` в редактируемый `/_config.yml` и настроить по своему усмотрению.
### Использование
1. Проверяем на существование `/source/_data/next.yml` файл (удаляем, если существует).
2. Копируем необходимые опции из конфига темы NexT `/themes/next/_config.yml` в `/_config.yml`, затем\
2.1. Сдвигаем все опции вправо на 2 пробела (в Visual Studio Code: выделяем все строки, <kbd>CTRL</kbd> + <kbd>]</kbd>).\
2.2. Добавляем `theme_config:` параметр перед всеми этими настройками.
### Полезные ссылки
* [Конфигурация Hexo](https://hexo.io/ru/docs/configuration.html)
* [Hexo Pull #757](https://github.com/hexojs/hexo/pull/757)
<h2 align="center">Способ 2: NexT-Путь</h2>
Используя этот способ, вся конфигурация будет храниться в одном файле (`/source/_data/next.yml`), благодаря чему нет необходимости изменять оригинальный конфиг темы (`/themes/next/_config.yml`).
Но с этим способом могут не корректно обрабатываться все внешние библиотеки hexo при использовании их дополнительных опций (например, опции модуля `hexo-server` могут быть считаны только из стандартного конфига hexo).
Если в новых версиях появятся какие-то новые настройки, нужно просто скопировать эти настройки из оригинального `/themes/next/_config.yml` во внешний `_data/next.yml` и настроить по своему усмотрению.
Этот метод опирается на Hexo [дата-файлов](https://hexo.io/docs/data-files.html). И т.к. дата-файлы были представлены в Hexo 3, необходимо обновиться до Hexo 3.0 (или выше) для использования этой возможности.
### Использование
1. Убеждаемся, что Hexo версии 3 (или выше).
2. Создаём файл под именем `next.yml` в корневой директории сайта — `/source/_data` (создаём директорию `_data`, если отсутствует).
<p align="center">И после этих шагов есть <b>2 варианта</b>, нужно <b>выбрать только 1</b> из них и <b>продолжить следующие шаги</b>.</p>
* **Вариант 1: `override: false` (по-умолчанию)**:
1. Проверяем опцию `override` в стандартном конфиге NexT'а, должно быть установлено в `false`.\
В файле `next.yml` эта опция не должна быть вписана вовсе или вписана и установлена в `false`.
2. Копируем настройки из конфига темы NexT (`_config.yml`) и из корневого конфига сайта (`_config.yml`) в файл `/source/_data/next.yml`.
* **Вариант 2: `override: true`**:
1. В файле `next.yml` ставим опцию `override` в `true`.
2. Копируем **все** опции из оригинального конфига NexT'а `/themes/next/_config.yml` в `/source/_data/next.yml`.
3. Затем, в корневом конфиге сайта `/_config.yml` необходимо установить опцию `theme: next` (и если требуется, `source_dir: source`).
4. Используем станадартные параметры для запускаь генерации или развёртывания (`hexo clean && hexo g -d && hexo s`).
### Полезные ссылки
* [NexT Issue #328](https://github.com/iissnan/hexo-theme-next/issues/328)

View File

@ -1,121 +0,0 @@
<h1 align="center">Установка</h1>
<h2 align="center">Шаг 1 &rarr; Идём в директорию Hexo</h2>
Меняем каталог на **корневой hexo**. Там должны находиться `node_modules`, `source`, `themes` и другие папки:
```sh
$ cd hexo
$ ls
_config.yml node_modules package.json public scaffolds source themes
```
<h2 align="center">Шаг 2 &rarr; Скачиваем NexT</h2>
<p align="center">Скачиваем тему с GitHub.<br>
Имеются <b>3 способа</b> как зделать это, нужно <b>выбрать только 1</b> из них.</p>
### Способ 1: Скачиваем [последнюю версию релиза][releases-latest-url]
В большинстве случаев **стабильна**. Рекомендуется для начинающих пользователей.
* Установка с помощью [curl & tar & wget][curl-tar-wget-url]:
```sh
$ mkdir themes/next
$ curl -s https://api.github.com/repos/next-theme/hexo-theme-next/releases/latest | grep tarball_url | cut -d '"' -f 4 | wget -i - -O- | tar -zx -C themes/next --strip-components=1
```
Этим способом Вы скачаете **только последнюю версию релиза** (без директории `.git` внутри).\
Поэтому, в дальнейшем будет невозможно обновить эту версию через `git`.\
Зато всегда можно использовать отдельную конфигурацию (т.е. [дата-файлы][docs-data-files-url]) и скачивать новую версию перезаписывая старую (или создать новый каталог и переопределить параметр `theme` в конфиге Hexo), без потери старой конфигурации.
### Способ 2: Скачиваем [указанную версию релиза][releases-url]
В редких случаях полезно, но не рекомендуется.\
Необходимо указать версию. Замените `v6.0.0` на любую версию из [списка тэгов][tags-url].
* Вариант 1: Установка с помощью [curl & tar][curl-tar-url]:
```sh
$ mkdir themes/next
$ curl -L https://api.github.com/repos/next-theme/hexo-theme-next/tarball/v6.0.0 | tar -zxv -C themes/next --strip-components=1
```
То же, что и описано выше в способе `curl & tar & wget`, но скачает **только конкретную версию**.
* Вариант 2: Установка с помощью [git][git-url]:
```sh
$ git clone --branch v6.0.0 https://github.com/next-theme/hexo-theme-next themes/next
```
Этот вариант скачает **указанную версию релиза** (включая директорию `.git` внутри).\
И в любой момент Вы можете переключиться на любую весию тэга, но с лимитом до указанной версии.
### Способ 3: Скачиваем [последнюю мастер-ветку][download-latest-url]
Иногда может быть **нестабильна**, но включает самые последние нововведения. Рекомендуется для продвинутых пользователей и для разработчиков.
* Вариант 1: Установка с помощью [curl & tar][curl-tar-url]:
```sh
$ mkdir themes/next
$ curl -L https://api.github.com/repos/next-theme/hexo-theme-next/tarball | tar -zxv -C themes/next --strip-components=1
```
То же, что и описано выше в варианте `curl & tar & wget`, но скачает **только последнюю мастер-ветку**.\
В некоторых случаях полезно для разработчиков.
* Вариант 2: Установка с помощью [git][git-url]:
```sh
$ git clone https://github.com/next-theme/hexo-theme-next themes/next
```
Этот вариант скачает **весь репозиторий** (включая директорию `.git` внутри).\
И в любой момент Вы можете [обновить текущую версию через git][update-with-git-url] и переключиться на любую версию тэга или на последнюю мастер или любую другую ветку.\
В большинстве случаев полезно как для пользователей, так и для разработчиков.
Смотрим список тэгов:
```sh
$ cd themes/next
$ git tag -l
v6.0.0
v6.0.1
v6.0.2
```
Например, Вы хотите переключиться на [версию релиза][tags-url] `v6.0.1`. Вводим следующую команду:
```sh
$ git checkout tags/v6.0.1
Note: checking out 'tags/v6.0.1'.
HEAD is now at da9cdd2... Release v6.0.1
```
И если вы хотите переключиться обратно на [мастер-ветку][commits-url], вводим следующее:
```sh
$ git checkout master
```
<h2 align="center">Шаг 3 &rarr; Конфигурируем</h2>
Устанавливаем параметр темы в конфиге `_config.yml` **корневой директории hexo**:
```yml
theme: next
```
[download-latest-url]: https://github.com/next-theme/hexo-theme-next/archive/master.zip
[releases-latest-url]: https://github.com/next-theme/hexo-theme-next/releases/latest
[releases-url]: https://github.com/next-theme/hexo-theme-next/releases
[tags-url]: https://github.com/next-theme/hexo-theme-next/tags
[commits-url]: https://github.com/next-theme/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/next-theme/hexo-theme-next/blob/master/docs/ru/README.md#%D0%A3%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BA%D0%B0
[docs-data-files-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/ru/DATA-FILES.md

View File

@ -103,9 +103,9 @@ $ git pull
<sub>Crowdin позволяет нам удобно переводить документацию.</sub>
</p>
[docs-installation-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/ru/INSTALLATION.md
[docs-data-files-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/ru/DATA-FILES.md
[docs-update-5-1-x-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/ru/UPDATE-FROM-5.1.X.md
[docs-installation-url]: https://theme-next.js.org/docs/getting-started/installation.html
[docs-data-files-url]: https://theme-next.js.org/docs/getting-started/configuration.html
[docs-update-5-1-x-url]: https://theme-next.js.org/docs/getting-started/update-from-v5.html
[t-chat-url]: https://t.me/theme_next
[gitter-url]: https://gitter.im/theme-next

View File

@ -1,18 +0,0 @@
<h1 align="center">Обновление из-под NexT v5.1.x</h1>
Между версией 5.1.x и последней версиями нет жёстких изменений. Версия сменилась на мажорную 7 по следующим причинам:
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. 3rd-party плагин [`hexo-wordcount`](https://github.com/willin/hexo-wordcount) был заменён на [`hexo-symbols-count-time`](https://github.com/next-theme/hexo-symbols-count-time) т.к. `hexo-symbols-count-time` не имеет никаких сторонних Node.js зависимостей, не имеет [языкового фильтра](https://github.com/willin/hexo-wordcount/issues/7) что обеспечивает улучшенную производительность при генерации сайта.
Поэтому, я предлагаю обновиться с версии 5 на версию 7 следующим способом:
1. Вы не трогаете старую директорию `next`, а всего-лишь делаете резервные копии файлов NexT:\
1.1. `config.yml` или `next.yml` (если Вы использовали [дата-файлы](DATA-FILES.md)).\
1.2. Пользовательских CSS-стилей, которые расположены в `next/source/css/_custom/*` и `next/source/css/_variables/*` директориях.\
1.3. Пользовательских layout-стилей, которые расположены в `next/layout/_custom/*`.\
1.4. Любые другие всевозможные пользовательские изменения, которые могут быть найдены любым инструментом для сравнения файлов.
2. Склонировать новый репозиторий в любую другую директорию, отличную от `next`. Например, в директорию `next-reloaded`: `git clone https://github.com/next-theme/hexo-theme-next themes/next-reloaded`. Итак, нет необходимости трогать старую NexT 5.1.x директорию и можно работать с новой `next-reloaded`.
3. Открываем главную Hexo-конфигурацию и устанавливаем параметр темы: `theme: next-reloaded`. Так Ваша директория `next-reloaded` должна грузиться при генерации. Если Вы будете наблюдать какие-либо баги или Вам попросту не нравится эта новая версия, в любой момент Вы можете использовать старую 5.1.x.
А как активировать 3rd-party библиотеки, смотрим здесь [здесь](https://github.com/next-theme/hexo-theme-next/blob/master/docs/ru/INSTALLATION.md#%D0%9F%D0%BB%D0%B0%D0%B3%D0%B8%D0%BD%D1%8B).

View File

@ -1,80 +0,0 @@
<h1 align="center">Algolia 搜索</h1>
NexT 内部提供 Algolia 的搜索功能,要使用此功能请确保所使用的 NexT 版本在 `v5.1.0` 之后。需要注意的是,仅仅将 `next/_config.yml``algolia_search``enable` 打开**并不能让你使用 Algolia 搜索**,你还需要**使用对应的 Hexo-Algolia 插件** 才能真正在博客页面中使用 Algolia 搜索。按照下面介绍的步骤操作即可完成 Algolia 搜索的安装。
1. 前往 [Algolia 注册页面](https://www.algolia.com/),注册一个新账户。 可以使用 GitHub 或者 Google 账户直接登录,注册后的 14 天内拥有所有功能(包括收费类别的)。之后若未续费会自动降级为免费账户,免费账户 总共有 10,000 条记录,每月有 100,000 的可以操作数。注册完成后,创建一个新的 Index这个 Index 将在后面使用。
![](https://user-images.githubusercontent.com/16272760/73673892-68a29b00-46ea-11ea-90c5-916b4b11fc7a.png)
1. 在 `API Keys` 页面找到需要使用的一些配置的值,包括 `Application ID``Search-Only API Key`。注意,`Admin API Key` 需要保密保存,不要外泄。
![](https://user-images.githubusercontent.com/16272760/73673895-693b3180-46ea-11ea-8f50-8bae850b50d0.png)
1. 编辑 `站点配置文件`,新增以下配置,除了 `chunkSize` 字段,替换成在 Algolia 获取到的值:
```yml
algolia:
applicationID: 'Application ID'
apiKey: 'Search-Only API Key'
indexName: 'indexName'
chunkSize: 5000
```
1. 在 `API Keys` 页面,点击 `All API Keys` 切换到对应的页面中。接着点击 `New API Key` 按钮,来**编辑权限**。在弹出框中找到 ACL **输入 addObject、 deleteObject、listIndexes、deleteIndex 权限**,然后点击最下方的 `Create` 按钮。将这个新创建的 API Key 复制到剪贴板,我们称之为 `High-privilege API key`
![](https://user-images.githubusercontent.com/16272760/73673902-6b04f500-46ea-11ea-9c80-4e5c5002e07b.png)
![](https://user-images.githubusercontent.com/16272760/73673905-6b9d8b80-46ea-11ea-9e01-702ec2a8a297.png)
1. 在 Index 和 API Key 创建完成后,此时这个 Index 里未包含任何数据。接下来需要安装 [Hexo Algolia](https://github.com/oncletom/hexo-algolia) 扩展,这个扩展的功能是搜集站点的内容并通过 API 发送给 Algolia。前往站点根目录执行命令安装
```
$ cd hexo
$ npm install hexo-algolia
```
1. 当配置完成,在站点根目录下执行以下命令来更新上传 Index。请注意观察命令的输出。
```
$ export HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # 使用 Git Bash
# set HEXO_ALGOLIA_INDEXING_KEY=High-privilege API key # 使用 Windows CMD 命令行
$ hexo clean
$ hexo algolia
```
![](http://theme-next.iissnan.com/uploads/algolia/algolia-step-4.png)
1. 更改`主题配置文件`,找到 Algolia Search 配置部分,将 `enable` 改为 `true`。同时你需要**关闭**其他搜索插件,如 Local Search 等。你也可以根据需要调整 `labels` 中的文本:
```yml
# Algolia Search
algolia_search:
enable: true
hits:
per_page: 10
labels:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}"
hits_stats: "${hits} results found in ${time} ms"
```
1. 如果你需要通过 CDN 使用其它版本的 algolia-instant-search ,请根据以下步骤操作。
你需要在`主题配置文件`中的 vendors 字段进行设置:
```yml
vendors:
...
# Algolia Search
# algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js
# instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js
algolia_search: //cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js
instant_search: //cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js
...
```
<h2 align="center">已知的问题</h2>
1. 考虑到 Algolia 免费账户的限制,目前 [Hexo-Algolia](https://github.com/oncletom/hexo-algolia) 插件最新版本去掉了正文索引功能。
1. [Hexo-Algoliasearch](https://github.com/LouisBarranqueiro/hexo-algoliasearch) 插件提供了正文索引功能,不过需要替换 NEXT 主题中的关键字。对于免费账户,`Record Too Big` 的问题同样存在。
- 替换 `source/js/algolia-search.js` 中所有的 `applicationID``appId`
- 替换 `layout/_partials/head/head.njk` 中所有的 `applicationID``appId`

View File

@ -1,39 +0,0 @@
<h1 align="center">配置文件</h1>
如何配置 Hexo 和 NexT传统的做法是存储部分配置在 Hexo 站点配置文件(`/_config.yml`),而另一部分在主题配置文件(`/themes/next/_config.yml`)。这一方式固然可用,但通过 `git pull` 或下载新的 release 版本来更新 NexT 主题的体验并不平滑。当用户使用 `git pull` 更新 NexT 主题时经常需要解决冲突问题,而在手动下载 release 版本时也经常需要手动合并配置。对于新版本的 Hexo主题可以通过 npm 安装;直接修改 `node_modules` 中的主题配置文件同样是困难的。
为了解决这一问题Hexo 提供了以下这些方案。请任选其一,然后继续后面的步骤。
## `theme_config` 方式
使用这一方式,你的全部配置都将置于 Hexo 站点配置文件(`/_config.yml`)中,并且不需要修改 `/themes/next/_config.yml`,或者创建什么其他的文件。但是所有用到的主题选项必须放置在 `theme_config` 后,并全部增加两个空格的缩进。
如果在新的 release 中新增了选项,那么你只需要从 `/themes/next/_config.yml` 中将它们复制到 `/_config.yml` 中并将它们的值设置为你想要的。
### 用法
从主题的 `/themes/next/_config.yml` 文件中复制你需要的 NexT 配置项到 `/_config.yml` 中,然后\
1. 所有这些配置项右移两个空格(在 Visual Studio Code 中:选中这些文字,<kbd>CTRL</kbd> + <kbd>]</kbd>)。\
2. 在这些参数最上方添加一行 `theme_config:`
## `_config.[name].yml` 方式
使用这一方式,你的主题配置将置于配置文件 `/_config.[name].yml` 中。这里的 `[name]` 需要替换为 Hexo 站点配置文件(`/_config.yml`)中 `theme` 项的名字,例如 `next`
如果在新的 release 中新增了选项,那么你只需要从 `/themes/next/_config.yml` 中将它们复制到此配置文件中并将它们的值设置为你想要的。
### 用法
1. 请确认你的 Hexo 版本为 4.3 或更高。
2. 根据你所使用的 NexT 主题的名字,在 Hexo 根目录下创建配置文件,例如 `_config.next.yml`
3. 从主题的 `/themes/next/_config.yml` 文件中复制你需要的 NexT 配置项到此配置文件中。
## `next.yml` 方式
较旧版本的 NexT 主题还提供了另一种配置方法,那就是将主题配置放置在 `/source/_data/next.yml` 文件中。这一方法已经废弃,请使用 `_config.[name].yml` 方式替代。如果存在 `/source/_data/next.yml` 文件,请将其移动到 Hexo 根目录并重命名为 `_config.next.yml`
## 相关链接
* [Hexo 配置](https://hexo.io/zh-cn/docs/configuration.html)
* [Hexo Pull #757](https://github.com/hexojs/hexo/pull/757)
* [Hexo Pull #4120](https://github.com/hexojs/hexo/pull/4120)

View File

@ -1,121 +0,0 @@
<h1 align="center">安装</h1>
<h2 align="center">步骤 1 &rarr; 进入 Hexo 目录</h2>
进入 **Hexo 根**目录。这一目录中应当有 `node_modules``source``themes` 等若干子目录:
```sh
$ cd hexo
$ ls
_config.yml node_modules package.json public scaffolds source themes
```
<h2 align="center">步骤 2 &rarr; 获取 NexT</h2>
<p align="center">从 GitHub 下载主题。<br>
为了下载这一主题,共有 <b>3 种选项</b>可选。你需要选择其中<b>唯一一个方式</b></p>
### 选项 1下载[最新 release 版本][releases-latest-url]
通常情况下请选择 **stable** 版本。推荐不熟悉的用户按此方式进行。
* 使用 [curl、tar 和 wget][curl-tar-wget-url] 安装:
```sh
$ mkdir themes/next
$ curl -s https://api.github.com/repos/next-theme/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/next-theme/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/next-theme/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/next-theme/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/next-theme/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 is now at da9cdd2... Release v6.0.1
```
然后,假设你想要切换回 [master 分支][commits-url],输入如下指令即可:
```sh
$ git checkout master
```
<h2 align="center">步骤 3 &rarr; 完成配置</h2>
**Hexo 站点配置文件**`/_config.yml`)中设置你的主题:
```yml
theme: next
```
[download-latest-url]: https://github.com/next-theme/hexo-theme-next/archive/master.zip
[releases-latest-url]: https://github.com/next-theme/hexo-theme-next/releases/latest
[releases-url]: https://github.com/next-theme/hexo-theme-next/releases
[tags-url]: https://github.com/next-theme/hexo-theme-next/tags
[commits-url]: https://github.com/next-theme/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/next-theme/hexo-theme-next/blob/master/docs/zh-CN/README.md#update
[docs-data-files-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/zh-CN/DATA-FILES.md

View File

@ -1,191 +0,0 @@
<h1 align="center">修复 LeanCloud 统计插件安全漏洞</h1>
在配置前,请升级 NexT 至 **v6.0.6** 以上。
在配置过程中请注意**博客配置文件**和**主题配置文件**的区别。
---
# 注册 LeanCloud 并创建应用
- 首先,前往 LeanCloud 官网 [leancloud.cn](https://leancloud.cn) 进行注册,并登录。
请注意,目前华东节点和华北节点创建应用需要先在账号设置完成实名认证,并且官方表明“[在国内市场将只服务于可验证的商业客户](https://leancloudblog.com/domain-incident/)”;美国节点暂无上述要求,并且账号系统与华东节点和华北节点是独立的,如需使用请前往 LeanCloud 国际版官网 [leancloud.app](https://leancloud.app) 注册登录。
- 然后点击图示 `1` 处,进入控制台:
![1](https://lc-cqha0xyi.cn-n1.lcfile.com/fc0c048a1e25dc3d10aa.jpg)
- 接着,点击图示 `1` 处,创建应用:
![2](https://lc-cqha0xyi.cn-n1.lcfile.com/33a56b754753a5d34b01.jpg)
- 在弹出窗口 `1` 处输入应用名称可随意输入可更改为演示方便取名为test并选择 `2` 处“开发版”,然后点击 `3` 处创建:
![3](https://lc-cqha0xyi.cn-n1.lcfile.com/649ccfc6f12015d1eefb.jpg)
到这里应用创建完成。
# 建立 Counter 类并在 NexT 中启用插件
- 点击 `1` 处应用名称进入应用管理界面:
![4](https://lc-cqha0xyi.cn-n1.lcfile.com/d0889df29841661e0b9e.jpg)
- 如图,点击侧边栏 `1` 处创建 Class
![5](https://lc-cqha0xyi.cn-n1.lcfile.com/b0fbc81bd6c19fa09a46.jpg)
- 在弹出窗口 `1` 处填入 `Counter`,勾选 `2` 处无限制,并点击 `3` 处创建 Class
![6](https://lc-cqha0xyi.cn-n1.lcfile.com/ae6154d6a55f02f11ebf.jpg)
- 此时类已创建完成。接下来点击图示 `1` 处进入设置,然后点击 `2` 处进入应用 Key
![8](https://lc-cqha0xyi.cn-n1.lcfile.com/9501a6372918dd9a8a92.jpg)
- 粘贴 `App ID``App Key`**NexT主题配置文件** `_config.yml` 对应位置。此时配置文件应如下:
```yml
leancloud_visitors:
enable: true
app_id: # <your app id>
app_key: # <your app key>
# Required for apps from CN region
server_url: # <your server url>
# Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security
security: true
```
- 设置Web安全域名确保域名调用安全。点击 `1` 处进入安全中心,然后在 `2` 处填写自己博客对应的域名(**注意协议、域名和端口号需严格一致**
![9](https://lc-cqha0xyi.cn-n1.lcfile.com/0e537cc4bec2e185201d.jpg)
到这里内容均与 Doublemine 的[为NexT主题添加文章阅读量统计功能](https://notes.wanghao.work/2015-10-21-%E4%B8%BANexT%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0%E6%96%87%E7%AB%A0%E9%98%85%E8%AF%BB%E9%87%8F%E7%BB%9F%E8%AE%A1%E5%8A%9F%E8%83%BD.html#%E9%85%8D%E7%BD%AELeanCloud)这篇文章相同只不过截图为新版的Leancloud的界面。
# 部署云引擎以保证访客数量不被随意篡改
- 点击左侧 `1` 处云引擎,然后点击 `2` 处部署,再点击 `3` 处在线编辑:
![10](https://lc-cqha0xyi.cn-n1.lcfile.com/d7056dfeeef7c5d66318.jpg)
- 点击 `1` 处创建函数:
![11](https://lc-cqha0xyi.cn-n1.lcfile.com/2737841bbc2bdd572ae0.jpg)
- 在弹出窗口选择 `1``Hook` 类型,然后 `2` 处选择 `beforeUpdate``3` 处选择刚才建立的 `Counter` 类。在 `4` 中粘贴下方代码后,点 `5` 处保存。
```javascript
var query = new AV.Query("Counter");
if (request.object.updatedKeys.includes('time')) {
return query.get(request.object.id).then(function (obj) {
if (obj.get("time") > request.object.get("time")) {
throw new AV.Cloud.Error('Invalid update!');
}
return request.object.save();
});
}
```
如图所示:
![12](https://lc-cqha0xyi.cn-n1.lcfile.com/a8e13418ed1d9405315b.jpg)
- 点击保存后应出现类似红框处函数。此时点击 `1` 处部署:
![13](https://lc-cqha0xyi.cn-n1.lcfile.com/ca56bf2e5fc2a1343565.jpg)
- 在弹出窗口点击 `1` 处部署:
![14](https://lc-cqha0xyi.cn-n1.lcfile.com/17548c13b3b23c71d845.jpg)
- 等待出现红框处的成功部署信息后,点击 `1` 处关闭:
![15](https://lc-cqha0xyi.cn-n1.lcfile.com/d2f50de6cefea9fd0ed3.jpg)
至此云引擎已成功部署,任何非法的访客数量更改请求都将失败。
# 进一步设置权限
- 打开**NexT主题配置文件** `_config.yml`,将 `leancloud_visitors` 下的 `security` 设置为 `true`(如没有则新增):
```yml
leancloud_visitors:
enable: true
app_id: # <your app id>
app_key: # <your app key>
# Required for apps from CN region
server_url: # <your server url>
# Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security
security: true
```
- 打开 cmd 并切换至**博客根目录**,键入以下命令以安装 `hexo-leancloud-counter-security` 插件:
```
npm install hexo-leancloud-counter-security
```
- 打开**博客配置文件** `_config.yml`,新增以下配置:
```yml
leancloud_counter_security:
enable_sync: true
app_id: <your app id>
app_key: <your app key>
username:
password:
```
- 在相同目录键入以下命令:
```
hexo lc-counter register <username> <password>
```
```
hexo lc-counter r <username> <password>
```
`<username>``<password>` 替换为你自己的用户名和密码(不必与 LeanCloud 的账号相同)。此用户名和密码将在 Hexo 部署时使用。
- 打开**博客配置文件** `_config.yml`,将 `<username>``<password>` 替换为你刚刚设置的用户名和密码:
```yml
leancloud_counter_security:
enable_sync: true
app_id: <your app id>
app_key: <your app key>
username: <your username> #如留空则将在部署时询问
password: <your password> #建议留空以保证安全性,如留空则将在部署时询问
```
- 在**博客配置文件** `_config.yml``deploy` 下添加项:
```yml
deploy:
# other deployer
- type: leancloud_counter_security_sync
```
- 返回 LeanCloud 控制台的应用内。依次点击 `1` `2`,检查 `_User` 表中是否出现一条记录(图示以用户名为 `admin` 为例):
![16](https://lc-cqha0xyi.cn-n1.lcfile.com/99faa5a0e7160e66d506.jpg)
- 点击 `1` 处进入 `Counter` 表,依次点击 `2` `3`,打开权限设置:
![17](https://lc-cqha0xyi.cn-n1.lcfile.com/b72a9e64579f5b71749d.jpg)
- <del>点击 `1` `add_field` 后选择 `2` 指定用户, 并将下两栏留空:</del> 此处应与下条 `create` 设置相同(选择你所创建的用户):
![18](https://lc-cqha0xyi.cn-n1.lcfile.com/14a8cb37062693d768ad.jpg)
- 点击 `1` `create` 后选择 `2` 指定用户, 在 `3` 处键入用户名,点击 `4` 处后点击 `5` 处添加:
![19](https://lc-cqha0xyi.cn-n1.lcfile.com/d91714cfd703ef42b94c.jpg)
完成此步操作后,界面应与图示类似:
![20](https://lc-cqha0xyi.cn-n1.lcfile.com/c05e7ec9218820baf412.jpg)
- 点击 `1` `delete` 后选择 `2` 指定用户, 并将下两栏留空:
![21](https://lc-cqha0xyi.cn-n1.lcfile.com/c37b6e20726cfb1d3197.jpg)
至此权限已设置完成,数据库记录只能在本地增删。
每次运行 `hexo d` 部署的时候,插件都会扫描本地 `source/_posts` 下的文章并与数据库对比,然后在数据库创建没有录入数据库的文章记录。
如果在**博客配置文件**中留空 `username``password` ,则在部署过程中程序会要求输入。
---
原文链接https://leaferx.online/2018/02/11/lc-security/

View File

@ -1,243 +0,0 @@
<h1 align="center">数学公式</h1>
NexT 内部提供数学公式渲染的引擎,这样你就不需要自己手动在模板中引入 JS 或者 CSS
只需要选择对应的渲染引擎,并在 `next/_config.yml` 中将其 `enable` 选项改为 `true` 即可。
需要注意的是,仅仅将 `enable` 打开**并不能让你看到数学公式**,你还需要**使用对应的 Hexo 渲染器(Renderer)** 才能真正在博客页面中显示出数学公式。引擎对应使用的 Hexo 渲染器会在引擎相关的部分介绍。
<h2 align="center">提供的渲染引擎</h2>
目前NexT 提供两种数学公式渲染引擎,分别为 [MathJax](https://www.mathjax.org/) 和 [Katex](https://khan.github.io/KaTeX/)。
### MathJax
如果你选择使用 MathJax 进行数学公式渲染,你需要使用 [hexo-renderer-pandoc](https://github.com/wzpan/hexo-renderer-pandoc) 或者 [hexo-renderer-kramed](https://github.com/sun11/hexo-renderer-kramed) (不推荐)作为 Hexo 的 Markdown 渲染器。
首先,卸载原有的渲染器 `hexo-renderer-marked`,并安装这两种渲染器的**其中一个**
```sh
npm uninstall hexo-renderer-marked
npm install hexo-renderer-pandoc # 或者 hexo-renderer-kramed
```
然后在 `next/_config.yml` 中将 `mathjax``enable` 打开。
```yml
math:
...
mathjax:
enable: true
```
执行 Hexo 生成,部署,或者启动服务器:
```sh
hexo clean && hexo g -d
# 或者 hexo clean && hexo s
```
#### 使用 MathJax 给公式编号并引用公式
在新版本的 NexT 主题中,我们加入了公式自动编号和引用功能。下面简要介绍一下如何使用这项功能。
为了使用这项功能,一般来说,你必须把所使用的 LaTeX 公式放在 `equation` 环境里面,采用旧的方法(也就是说,仅仅把公式的每一边用两个 $ 符号包含起来)是无效的。如何引用公式?你只需要在书写公式的时候给公式一个 `\label{}` 标记tag然后在正文中可以使用 `\ref{}` 或者 `\eqref{}` 命令来引用对应的公式。使用 `\eqref{}` 是推荐的方式,因为如果你使用 `\ref{}`,公式在文中的引用编号将没有圆括号包围。下面介绍几种常见的公式编号例子。
对于简单的公式,使用下面的方式给公式一个标记,
```latex
$$\begin{equation}\label{eq1}
e=mc^2
\end{equation}$$
```
然后,在正文中,你可以轻松引用上述公式,一个简单的例子如下:
```
著名的质能方程 $\eqref{eq1}$ 由爱因斯坦提出 ...
```
对于多行公式,在 `equation` 环境中,你可以使用 `aligned` 环境把公式分成多行,
```latex
$$\begin{equation}\label{eq2}
\begin{aligned}
a &= b + c \\
&= d + e + f + g \\
&= h + i
\end{aligned}
\end{equation}$$
```
要对齐多个公式,我们需要使用 `align` 环境。align 环境中的每个公式都有自己的编号:
```
$$\begin{align}
a &= b + c \label{eq3} \\
x &= yz \label{eq4}\\
l &= m - n \label{eq5}
\end{align}$$
```
`align` 环境中,如果你不想给某个或某几个公式编号,那么在这些公式后面使用 [`\nonumber`](https://tex.stackexchange.com/questions/17528/show-equation-number-only-once-in-align-environment) 命令即可。例如:
```latex
$$\begin{align}
-4 + 5x &= 2+y \nonumber \\
w+2 &= -1+w \\
ab &= cb
\end{align}$$
```
有时,你可能会希望采用更加奇特的方式来标记和引用你的公式,你可以通过使用 `\tag{}` 命令来实现,例如:
```latex
$$x+1\over\sqrt{1-x^2} \tag{i}\label{eq_tag}$$
```
如果你想要了解更多信息,请访问 [MathJax 关于公式编号的官方文档](https://docs.mathjax.org/en/latest/input/tex/eqnumbers.html)。同时,你也可以阅读 [这篇文档](https://theme-next.js.org/docs/third-party-services/math-equations) 来获取更多细节信息。
### Katex
Katex 渲染引擎相对于 MathJax 来说**大大提高了速度**,而且在关掉 JavaScript 时也能渲染数学公式。
但是 Katex 所支持的东西没有 MathJax 全面,你可以从下面的相关链接中获取更多的信息。
如果你选择使用 Katex 进行数学公式渲染,你需要使用 [hexo-renderer-markdown-it-plus](https://github.com/CHENXCHEN/hexo-renderer-markdown-it-plus) 或者 [hexo-renderer-markdown-it](https://github.com/hexojs/hexo-renderer-markdown-it) 这两种渲染器的其中一个。
首先,卸载原有的渲染器 `hexo-renderer-marked`,并安装这两种渲染器的**其中一个**
```sh
npm uninstall hexo-renderer-marked
npm install hexo-renderer-markdown-it-plus
# 或者 hexo-renderer-markdown-it
```
然后在 `next/_config.yml` 中将 `katex``enable` 打开。
```yml
math:
...
katex:
enable: true
```
执行 Hexo 生成,部署,或者启动服务器:
```sh
hexo clean && hexo g -d
# 或者 hexo clean && hexo s
```
#### 如果你使用 hexo-renderer-markdown-it
如果你使用 `hexo-renderer-markdown-it`,你还需要为其加上 `markdown-it-katex` 作为插件:
```
npm install markdown-it-katex
```
然后在 `hexo/_config.yml` 中将 `markdown-it-katex` 作为插件写入 `hexo-renderer-markdown-it` 的配置中:
```yml
markdown:
render:
html: true
xhtmlOut: false
breaks: true
linkify: true
typographer: true
quotes: '“”‘’'
plugins:
- markdown-it-katex
```
#### 已知的问题
1. 首先请查阅 Katex 的 [Common Issue](https://github.com/Khan/KaTeX#common-issues)
2. 块级公式(例如 `$$...$$`)必须位于空行。\
即在开头的 `$$` 前和在结尾的 `$$` 后不能有除了空白字符以外的其他字符。([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-357489509))
3. 不支持 Unicode。([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-357489509))
4. 行内公式(例如 `$...$`)在开头的 `$` 后面和结尾的 `$` 前面**不能含有空格**。([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-357489509))
5. 如果你在文章的各级标题中(例如 `## 标题`)使用公式。\
那么文章目录中的这个标题会出现 3 次未渲染的公式代码([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-359018694))
6. 如果你在文章 Title 中使用公式,那么公式将不会被渲染。([#32comment](https://github.com/theme-next/hexo-theme-next/pull/32#issuecomment-359142879))
我们目前使用的 Katex 版本为 0.11.1,这里面可能有某些问题是因为 Katex 版本老旧导致的;
但是,就像上面所说的,数学公式的渲染必须依靠渲染器来支持,目前的 Katex 相关的渲染器仅支持到 Katex 0.11.1
我们会持续关注相关渲染器的更新,如果有渲染器支持更高版本的 Katex我们会及时更新我们的 Katex 版本。
### 相关链接
* [Katex 与 MathJax 渲染速度对比](https://www.intmath.com/cg5/katex-mathjax-comparison.php)
* [Katex 支持的功能列表](https://khan.github.io/KaTeX/function-support.html)
<h2 align="center">相关配置说明</h2>
注意,在修改配置选项时,**不要更改配置的缩进**
目前NexT 的所有配置都采用**2 空格的缩进**
如果配置的内容接在冒号后面,那么内容和冒号之间必须有一个空格(例如`enable: true`)
```yml
# Math Formulas Render Support
math:
# Default (true) will load mathjax / katex script on demand.
# That is it only render those page which has `mathjax: true` in Front-matter.
# If you set it to false, it will load mathjax / katex srcipt EVERY PAGE.
per_page: true
# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support.
mathjax:
enable: true
# See: https://mhchem.github.io/MathJax-mhchem/
mhchem: false
# hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugin) required for full Katex support.
katex:
enable: false
# See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex
copy_tex: false
```
### `per_page`
`true` 或者 `false`,默认为 `true`
这个选项是控制是否在每篇文章都渲染数学公式;
默认(`true`) 的行为是**只对 Front-matter 中含有 `mathjax: true` 的文章进行数学公式渲染**。
如果 Front-matter 中不含有 `mathjax: true`,或者 `mathjax: false`,那么 NexT 将不会对这些文章进行数学公式渲染。
例如:
```md
<!-- 这篇文章会渲染数学公式 -->
---
title: 'Will Render Math'
mathjax: true
---
....
```
```md
<!-- 这篇文章不会渲染数学公式 -->
---
title: 'Not Render Math'
mathjax: false
---
....
```
```md
<!-- 这篇文章也不会渲染数学公式 -->
---
title: 'Not Render Math Either'
---
....
```
当你将它设置为 `false` 时,它就会在每个页面都加载 MathJax 或者 Katex 来进行数学公式渲染。

View File

@ -121,9 +121,9 @@ $ git pull
<sub>Crowdin 容许我们方便地翻译文档。</sub>
</p>
[docs-installation-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/zh-CN/INSTALLATION.md
[docs-data-files-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/zh-CN/DATA-FILES.md
[docs-update-5-1-x-url]: https://github.com/next-theme/hexo-theme-next/blob/master/docs/zh-CN/UPDATE-FROM-5.1.X.md
[docs-installation-url]: https://theme-next.js.org/docs/getting-started/installation.html
[docs-data-files-url]: https://theme-next.js.org/docs/getting-started/configuration.html
[docs-update-5-1-x-url]: https://theme-next.js.org/docs/getting-started/update-from-v5.html
[t-chat-url]: https://t.me/theme_next_chinese
[gitter-url]: https://gitter.im/theme-next

View File

@ -1,40 +0,0 @@
<h1 align="center">从 NexT v5.1.x 更新</h1>
在使用 Hexo 3 时NexT V5 版本仍然能够正常运行,但是如果你想获得更多的功能和帮助,还是建议您升级到 NexT V7+ 版本,并移步 [Theme-Next](https://github.com/next-theme/hexo-theme-next) 仓库。
在 5.1.x 版本和新版本之间没有很大的革命性改进。主版本号变更至 7 主要是因为:
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/next-theme/hexo-symbols-count-time) 所取代,因为 `hexo-symbols-count-time` 没有任何外部 Node.js 依赖、也没有会导致生成站点时的性能问题 [language filter](https://github.com/willin/hexo-wordcount/issues/7)。
我们推荐通过如下步骤从 v5 升级到 v7
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. 任何其它可能的附加自定义内容;为了定位它们,你可以通过某些工具在仓库间比较。
2. 克隆新的仓库到任一异于 `next` 的目录(如 `next-reloaded`
```sh
$ git clone https://github.com/next-theme/hexo-theme-next themes/next-reloaded
```
如此,你可以在不修改原有的 NexT v5.1.x 目录的同时使用 `next-reloaded` 目录中的新版本主题。
3. 在 Hexo 的主配置文件中设置主题:
```yml
...
theme: next-reloaded
...
```
如此,你的 `next-reloaded` 主题将在生成站点时被加载。如果你遇到了任何错误、或只是不喜欢这一新版本,你可以随时切换回旧的 v5.1.x 版本。
4. 更新语言配置
从 v6.0.3 版本起,`zh-Hans` 改名为 `zh-CN`https://github.com/next-theme/hexo-theme-next/releases/tag/v6.0.3
升级到 v6.0.3 及以后版本的用户,需要显式修改 Hexo 主配置文件 `_config.yml` 里的 `language` 配置,否则语言显示不正确。
5. 更新 Hexo 和 Hexo 插件
如果完成了以上步骤后,执行 `hexo s``hexo g` 出现错误,这意味着可能是旧版的 Hexo 和 Hexo 插件与新版的 NexT 主题产生了冲突。我们建议将 Hexo 升级至 4.0 以上的版本,将 Hexo 插件升级到最新版本。你可以执行 `npm outdated` 查看所有可以升级的插件。
关于第三方库的启用,参见[这里](https://github.com/next-theme/hexo-theme-next/blob/master/docs/zh-CN/INSTALLATION.md#插件)。