support external URLs in redirect template

for tpo/tpa/team#41687
This commit is contained in:
Jérôme Charaoui 2024-07-30 12:24:13 -04:00
parent ce5d6409f6
commit 6778dfc45f
No known key found for this signature in database
GPG Key ID: 69C52F658E988542
2 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,12 @@ label = Redirect Target
type = string type = string
description = Target is of type 'string' to allow relative paths. Converted to url in the template. description = Target is of type 'string' to allow relative paths. Converted to url in the template.
[fields.external]
label = External URL
type = boolean
description = Target is an external (absolute) URL.
default = false
[fields.key] [fields.key]
label = Key label = Key
type = sort_key type = sort_key

View File

@ -1 +1,5 @@
{% if this.external -%}
<meta http-equiv="refresh" content="0; URL='{{ this.target }}'" />
{%- else -%}
<meta http-equiv="refresh" content="0; URL='{{ this.target|url }}'" /> <meta http-equiv="refresh" content="0; URL='{{ this.target|url }}'" />
{% endif -%}