Hello, I am beginner to Zola, sorry if this question has been asked before I couldn’t find anything.
How do I redirect to an external url on page load? I want to create routes which immediately redirects to an external site on page load.
I tried doing
<div onload="javascript:window.location.replace('https://google.com'))">
</div>
and
<script type="text/javascript">
window.onload = function () {
window.location.replace('https://google.com')
window.location.href = "https://google.com"
}
</script>
Didn’t work but then later I created a shortcode redirector.html
<script>
window.onload = function() {
window.location.href = '{{ url }}'
}
</script>
and used it like this
+++
+++
{{ redirector(url = "https://google.com") }}
This does seem to be redirecting but it encoded the url so it doesnt work.
https://&/#x2F;/google.com