Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions content/redirects/.example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+++
title = "Redirect example"
template = "redirect.html"

# Other paths in the website to redirect. For example, the below causes
# berkeley.mt/redirect-example to also be a redirect
aliases = ["/redirect-example"]

# The page to redirect to
extra.url = "https://sm.tream.ing"
+++
4 changes: 4 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">

{% block canonical %}
{% set permalink = section.permalink
| default(value=page.permalink
| default(value="")) %}

{% if permalink and permalink is not starting_with("/") %}
<link rel="canonical" href="{{ permalink | safe }}" />
{% endif %}
{% endblock %}

{% set title = section.title
| default(value=page.title
Expand Down Expand Up @@ -59,6 +61,8 @@
document.getElementById("navbar").classList.toggle("open");
}
</script>

{% block extra_head %}{% endblock %}
</head>

<body>
Expand Down
19 changes: 19 additions & 0 deletions templates/redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends "base.html" %}

{% block canonical %}
<link rel="canonical" href="{{ page.extra.url | safe }}">
{% endblock canonical %}

{% block extra_head %}
<noscript>
<meta http-equiv="refresh" content="0; url={{ page.extra.url | safe }}">
</noscript>

<script>
window.location.replace("{{ page.extra.url | safe }}");
</script>
{% endblock extra_head %}

{% block content %}
<p>If you are not redirected automatically, follow <a href="{{ page.extra.url | safe }}">this link</a> to be redirected.</p>
{% endblock content %}
Loading