a11y: include site description within page titles

This is not the same as the short SITE_NAME which is displayed as the title of the (home)page for instance.
This commit is contained in:
David Larlet 2025-01-27 16:08:54 -05:00
parent 3b9a0c0951
commit 44aa914658
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD
19 changed files with 58 additions and 7 deletions

View file

@ -98,7 +98,12 @@ Eg.: `SHORT_SITE_URL=https://u.umap.org`
#### SITE_NAME #### SITE_NAME
The name of the site, to be used in header and HTML title. The name of the site, to be used in header.
#### SITE_DESCRIPTION
The description of the site, to be used in HTML title.
#### SITE_URL #### SITE_URL

View file

@ -7,6 +7,7 @@ def settings(request):
return { return {
"UMAP_HELP_URL": djsettings.UMAP_HELP_URL, "UMAP_HELP_URL": djsettings.UMAP_HELP_URL,
"SITE_NAME": djsettings.SITE_NAME, "SITE_NAME": djsettings.SITE_NAME,
"SITE_DESCRIPTION": djsettings.SITE_DESCRIPTION,
"SITE_URL": djsettings.SITE_URL, "SITE_URL": djsettings.SITE_URL,
"ENABLE_ACCOUNT_LOGIN": djsettings.ENABLE_ACCOUNT_LOGIN, "ENABLE_ACCOUNT_LOGIN": djsettings.ENABLE_ACCOUNT_LOGIN,
"UMAP_READONLY": djsettings.UMAP_READONLY, "UMAP_READONLY": djsettings.UMAP_READONLY,

View file

@ -267,6 +267,7 @@ UMAP_KEEP_VERSIONS = env.int("UMAP_KEEP_VERSIONS", default=10)
SITE_URL = env("SITE_URL", default="http://umap.org") SITE_URL = env("SITE_URL", default="http://umap.org")
SHORT_SITE_URL = env("SHORT_SITE_URL", default=None) SHORT_SITE_URL = env("SHORT_SITE_URL", default=None)
SITE_NAME = "uMap" SITE_NAME = "uMap"
SITE_DESCRIPTION = "Online map creator"
UMAP_DEMO_SITE = env("UMAP_DEMO_SITE", default=False) UMAP_DEMO_SITE = env("UMAP_DEMO_SITE", default=False)
UMAP_EXCLUDE_DEFAULT_MAPS = False UMAP_EXCLUDE_DEFAULT_MAPS = False
UMAP_MAPS_PER_PAGE = 5 UMAP_MAPS_PER_PAGE = 5

View file

@ -2,6 +2,10 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% blocktranslate %}{{ current_user }}s maps{% endblocktranslate %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block maincontent %} {% block maincontent %}
<div class="col wide"> <div class="col wide">
<h2 class="section"> <h2 class="section">

View file

@ -2,6 +2,9 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% translate "My Profile" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block maincontent %} {% block maincontent %}
{% include "umap/dashboard_menu.html" with selected="profile" %} {% include "umap/dashboard_menu.html" with selected="profile" %}
<div class="wrapper"> <div class="wrapper">

View file

@ -2,6 +2,10 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% blocktranslate %}{{ current_user }}s starred maps{% endblocktranslate %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block maincontent %} {% block maincontent %}
<div class="col wide"> <div class="col wide">
<h2 class="section"> <h2 class="section">

View file

@ -5,7 +5,7 @@
<head> <head>
<title> <title>
{% block head_title %} {% block head_title %}
{{ SITE_NAME }} {{ SITE_NAME }} - {{ SITE_DESCRIPTION }}
{% endblock head_title %} {% endblock head_title %}
</title> </title>
<meta charset="utf-8"> <meta charset="utf-8">

View file

@ -3,7 +3,7 @@
{% load i18n %} {% load i18n %}
{% block head_title %} {% block head_title %}
{% trans "Login" %} {% trans "Login" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %} {% endblock head_title %}
{% load umap_tags i18n %} {% load umap_tags i18n %}

View file

@ -1,4 +1,9 @@
{% extends "umap/content.html" %} {% extends "umap/content.html" %}
{% load i18n %}
{% block head_title %}
{% translate "About" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block maincontent %} {% block maincontent %}
{% include "umap/about_summary.html" %} {% include "umap/about_summary.html" %}

View file

@ -3,7 +3,7 @@
{% load umap_tags i18n %} {% load umap_tags i18n %}
{% block head_title %} {% block head_title %}
{{ map.name }} - {{ SITE_NAME }} {{ map.name }} - {{ SITE_NAME }} - {{ SITE_DESCRIPTION }}
{% endblock head_title %} {% endblock head_title %}
{% block body_class %} {% block body_class %}
map_detail map_detail

View file

@ -2,6 +2,10 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% translate "Password change" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block content %} {% block content %}
<h2 class="section"> <h2 class="section">
{% trans "Password change" %} {% trans "Password change" %}

View file

@ -2,6 +2,10 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% translate "Password change successful" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block content %} {% block content %}
<h2 class="section"> <h2 class="section">
{% trans "Password change successful" %} {% trans "Password change successful" %}

View file

@ -2,6 +2,10 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% translate "Explore maps" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block messages %} {% block messages %}
{# We don't want maps from the results list to display errors in the main page. #} {# We don't want maps from the results list to display errors in the main page. #}
{% endblock messages %} {% endblock messages %}

View file

@ -2,6 +2,10 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% translate "Team deletion" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block maincontent %} {% block maincontent %}
{% include "umap/dashboard_menu.html" with selected="teams" %} {% include "umap/dashboard_menu.html" with selected="teams" %}
<div class="wrapper"> <div class="wrapper">

View file

@ -2,6 +2,10 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% blocktranslate %}{{ current_team }}s maps{% endblocktranslate %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block maincontent %} {% block maincontent %}
<div class="wrapper"> <div class="wrapper">
<div class="row"> <div class="row">

View file

@ -2,6 +2,10 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% translate "Create or edit a team" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block maincontent %} {% block maincontent %}
{% include "umap/dashboard_menu.html" with selected="teams" %} {% include "umap/dashboard_menu.html" with selected="teams" %}
<div class="wrapper"> <div class="wrapper">

View file

@ -3,7 +3,7 @@
{% load i18n static %} {% load i18n static %}
{% block head_title %} {% block head_title %}
{{ SITE_NAME }} - {% trans "My Dashboard" %} {% translate "My Dashboard" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %} {% endblock head_title %}
{% block maincontent %} {% block maincontent %}
{% trans "Search my maps" as placeholder %} {% trans "Search my maps" as placeholder %}

View file

@ -2,6 +2,10 @@
{% load i18n %} {% load i18n %}
{% block head_title %}
{% translate "My Teams" %} - {{ SITE_DESCRIPTION }}
{% endblock head_title %}
{% block maincontent %} {% block maincontent %}
{% include "umap/dashboard_menu.html" with selected="teams" %} {% include "umap/dashboard_menu.html" with selected="teams" %}
<div class="wrapper"> <div class="wrapper">

View file

@ -8,7 +8,7 @@ from umap.models import Map
def test_page_title(page, live_server): def test_page_title(page, live_server):
page.goto(live_server.url) page.goto(live_server.url)
expect(page).to_have_title("uMap") expect(page).to_have_title("uMap - Online map creator")
@pytest.mark.parametrize( @pytest.mark.parametrize(
@ -83,7 +83,7 @@ def test_login_from_map_page(live_server, page, tilelayer, settings, user, conte
page.get_by_role("button", name="Save").click() page.get_by_role("button", name="Save").click()
assert Map.objects.count() == 0 assert Map.objects.count() == 0
login_page = login_page_info.value login_page = login_page_info.value
expect(login_page).to_have_title("Login") expect(login_page).to_have_title("Login - Online map creator")
login_page.get_by_placeholder("Username").fill(user.username) login_page.get_by_placeholder("Username").fill(user.username)
login_page.get_by_placeholder("Password").fill("123123") login_page.get_by_placeholder("Password").fill("123123")
with page.expect_response(re.compile(r".*/map/create/")): with page.expect_response(re.compile(r".*/map/create/")):