Skip to content

Commit

Permalink
add url canonicals
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-mh committed Sep 23, 2024
1 parent dda7f91 commit 01f9ae5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions stratum/config/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class TestingConfig(BaseConfig):


class DevelopmentConfig(BaseConfig):
URL = "http://localhost:5000"
ALT_URL = "http://127.0.0.1:5000"

SECRET_KEY = "testing"
CACHE_TYPE = "SimpleCache"

Expand Down
3 changes: 3 additions & 0 deletions stratum/config/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ def _get_secret(name: str) -> str:


class ProductionConfig(BaseConfig):
URL = "https://stratumauth.com"
ALT_URL = "http://www.stratumauth.com"

SECRET_KEY = _get_secret("secret_key")

CACHE_TYPE = "RedisCache"
Expand Down
4 changes: 4 additions & 0 deletions stratum/templates/base.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<title>{% block title %}{% endblock %} - Stratum</title>
<meta name="description" content="{% block description %}{% endblock %}">

{% if request.url.startswith(config["ALT_URL"]) %}
<link rel="canonical" href="{{ config['URL'] }}{{ request.path }}">
{% endif %}

<link rel="preload" href="{{ url_for('static', filename='fonts/rubik-v26-latin-regular.woff2') }}" as="font">
<link rel="preload" href="{{ url_for('static', filename='fonts/rubik-v26-latin-500.woff2') }}" as="font">
<link rel="preload" href="{{ url_for('static', filename='fonts/roboto-mono-v22-latin-regular.woff2') }}" as="font">
Expand Down

0 comments on commit 01f9ae5

Please sign in to comment.