Redirect

Redirect users to an external URL

The redirect task is responsible for redirecting users to an external url. It is

A typical redirect task looks like this:

{
    type:'redirect',
    url: 'my/redirect/url'    
}

The API is as follows:

propertydescription
urlThe url we intend to redirect to.
conditionThe redirect will occur if condition is not defined or evaluates to true. If condition is a function it will be invoked and its result will be used instead.

The condition option is a bit advanced so here is an example of using it. The following code will only redirect if piGlobal.shouldRedirect is true.

{
    type:'redirect',
    url: 'my/redirect/url',
    condition: function(){
        return piGlobal.shouldRedirect;
    }
}
Last modified March 11, 2021: setup hugo (11980dc)