state.source.url
points to that location.state.source.redirections
dictates under what circumstances should Frontity make that request to the check if a redirection exists.state.source.redirections
accepts the following values:"no"
"all"
"404"
RegExp:
. This pattern will be matched against the current route and if matched, Frontity will make an additional request to the WordPress instance to check if there exists a redirection for that route. Note that the shorthand character classes will have to be escaped, so for example instead of \d
, you will need to write \\d
."RegExp:"
which represent regular expressions. An additional request will be sent to Wordpress to check for the redirection if any of the regular expressions match the current route. If the array also contains a "404"
, an additional request will also be made if the original request has returned a 404.wp-source
package, state.source.redirections
which is used to handle the redirections. The recommended way of using it is by setting it in your frontity.settings.js
file.state.source.redirections
accepts the options outlined above.RedirectionData
object to state.source.data[link]
(details below in Technical details).state
or using a custom handler.state.source.data
with RedirectionData
directly:RedirectionData
object for the current route:actions.source.fetch()
. If the setting for state.source.redirections
contains an "eager" value (for example if it equals "all"
) it is fetched before calling the handler for the current route. "Fetching a redirection" refers to making a request to the WordPress instance to check if a redirection exists for a particular URL.state.source.redirections
is "404"
) then we fetch the redirection only after the request to the REST API has returned a 404.state.source.data[link]
with a RedirectionData
object instead of a "typical" Data
object like PostData
or AuthorData
. This object contains all the information about a redirection that Frontity needs in order to handle it. You can check the type of RedirectionData
to see all of its properties.RedirectionData
object is in the state, the behavior of Frontity is different on client and server.beforeSSR()
action of tiny-router
. If that object contains a redirection, Frontity will set the correct HTTP status, and redirect using ctx.redirect(data.location)
where data.location
contains the final URL .state.source.data
object and if the data
object for current route contains a redirection, Frontity calls actions.router.set(data.location)
where data.location
contains the final URL.