Redirecting a page in the template

Is there some kind of redirect tag in Grav? E.g. something like:

{% if page.header.redirect %}
{{ redirect to="{page.header.redirect}" }}
{% else %}
show page
{% endif %

Or similar… thanks

You can use {% redirect_me(page.header.redirect, 301) %}

Thank you!

Hi Flaviocopes, I get an error with that tag in template:

Unknown "redirect_me" tag in "redirect.html.twig" at line 1.

Sorry, it should be wrapped in {{ ... }} but I noticed it’s been added just 20 days ago, so it’s not yet available in the stable release (https://github.com/getgrav/grav/commit/8e1454b3abf0c72c13951cbf6003205ca742358f). Will be soon!

No worries, thanks :slight_smile: