hexo-generator-redirect
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "hexo-generator-redirect", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Hexo plugin that generates additional redirect pages", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,6 +0,8 @@ | ||
# hexo-generator-redirect | ||
# hexo-generator-redirect ![Publish on NPM](https://github.com/sergeyzwezdin/hexo-generator-redirect/workflows/Publish%20on%20NPM/badge.svg?branch=master) ![](https://img.shields.io/npm/v/hexo-generator-redirect) | ||
![Publish on NPM](https://github.com/sergeyzwezdin/hexo-generator-redirect/workflows/Publish%20on%20NPM/badge.svg?branch=master) ![](https://img.shields.io/npm/v/hexo-generator-redirect) | ||
`hexo-generator-redirect` is a plugin for Hexo static site generator that generates additional redirect pages. It's useful if you migrate your website and changed addresses for some posts. | ||
[Hexo](https://hexo.io/) plugin that generates additional redirect pages | ||
* Migrate to new URLs **without the pain**. | ||
* **Easy to install** and use. | ||
* **Custom templates** for the redirect page. | ||
@@ -11,12 +13,9 @@ ## Requirements | ||
## Installation | ||
## Usage | ||
1. Install the plugin using npm: | ||
```bash | ||
$ npm install hexo-generator-redirect --save-dev | ||
``` | ||
## Usage | ||
Add `redirect_from` key into frontmatter of the page: | ||
2. Add `redirect_from` key into frontmatter of the page: | ||
```yaml | ||
@@ -29,7 +28,11 @@ layout: post | ||
``` | ||
3. Create a layout template for the redirect page (for more details see below). | ||
4. Build the website 🤝. | ||
Create layout template for the redirect page. Create `redirect.ejs` in `layout` folder of your theme. | ||
## Creating the template | ||
You can use `post` variable in the template. To access the target page information, use `page.target.path`. | ||
Create `redirect.ejs` in the `layout` folder of your theme. | ||
You can use the `post` variable in the template. To access the target page information, use `page.target.path`. | ||
Here is an example of the redirect page layout (`redirect.ejs`): | ||
@@ -36,0 +39,0 @@ |
4197
48