In Geolizr, you have the possibility to create your own redirect filters in Javascript.

Syntax (please enter the script after the command {% render 'geolizr-init' %}:

<script>
  if(typeof Geolizr !== "undefined") {
    Geolizr.redirectFilter = function(redirect, targetUrlObject) {
      console.log(redirect);
      console.log(targetUrlObject);
      return true;
    }
  }
</script>

With these filters, you have the possibility to prevent or accept the redirect via the return value.


To stop:

return false

To accept

return true

In addition, you have the possibility to adjust the URL to which the redirection should take place.

You must adjust the key "url" in the parameter targetUrlObject. For example, you can use the example to convert the collection "candle" to the name "kerzen":

<script>
  if(typeof Geolizr !== "undefined") {
    Geolizr.redirectFilter = function(redirect, targetUrlObject) {
      if(targetUrlObject.url.match(/collections\/candles/)) {
        targetUrlObject.url = targetUrlObject.url.replace(/collections\/candles/, "collections/kerzen");
      }
      return true;
    }
  }
</script>