Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hexo-generator-redirect

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-generator-redirect

Hexo plugin that generates additional redirect pages

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

hexo-generator-redirect

Publish on NPM

Hexo plugin that generates additional redirect pages

Requirements

  • Hexo: 4.x
  • Node 12+

Installation

$ npm install hexo-generator-redirect --save-dev

Usage

Add redirect_from key into frontmatter of the page:

layout: post
title: Page
redirect_from:
- /old-url1
- /old-url2

Create layout template for the redirect page. Create redirect.ejs in layout folder of your theme.

You can use 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):

<% const newUrl = full_url_for(page.target.path) %>

<h1>Page address was changed</h1>
<p>The new page address is <a href="<%= newUrl %>"><%= newUrl %></a></p>

<script type="text/javascript">
  setTimeout(function(){ document.location.href = '<%= newUrl %>'; }, 5000);
</script>

Keywords

FAQs

Package last updated on 04 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc