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
7 changes: 3 additions & 4 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
User-agent: *
Crawl-delay: 10
Disallow:
Sitemap: sitemap.xml
User-agent: *
Disallow:
Sitemap: https://bewelcome.org/sitemap.xml
163 changes: 30 additions & 133 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,133 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.bewelcome.org/</loc>
<lastmod>2020-05-17T21:18:24+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/signup</loc>
<lastmod>2020-05-17T21:18:24+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about</loc>
<lastmod>2020-05-17T21:18:27+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/terms</loc>
<lastmod>2020-05-17T21:18:30+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/privacy</loc>
<lastmod>2020-05-17T21:18:28+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/impressum</loc>
<lastmod>2020-05-17T21:18:29+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/safety</loc>
<lastmod>2020-05-17T21:18:30+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/volunteer</loc>
<lastmod>2020-05-17T21:18:31+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/faq</loc>
<lastmod>2020-05-17T21:18:31+01:00</lastmod>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/getactive</loc>
<lastmod>2020-05-17T21:18:31+01:00</lastmod>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/thepeople</loc>
<lastmod>2020-05-17T21:18:32+01:00</lastmod>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.bewelcome.org/stats</loc>
<lastmod>2020-05-17T21:18:32+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/credits</loc>
<lastmod>2020-05-17T21:18:33+01:00</lastmod>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.bewelcome.org/login</loc>
<lastmod>2020-05-17T21:18:33+01:00</lastmod>
<priority>1.0</priority>
</url>
<url>
<loc>https://www.bewelcome.org/safety/basics</loc>
<lastmod>2020-05-17T21:18:33+01:00</lastmod>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.bewelcome.org/safety/whattodo</loc>
<lastmod>2020-05-17T21:18:33+01:00</lastmod>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.bewelcome.org/safety/team</loc>
<lastmod>2020-05-17T21:18:34+01:00</lastmod>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.bewelcome.org/safety/faq</loc>
<lastmod>2020-05-17T21:18:34+01:00</lastmod>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.bewelcome.org/safety/tips</loc>
<lastmod>2020-05-17T21:18:34+01:00</lastmod>
<priority>0.8</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/faq/2</loc>
<lastmod>2020-05-17T21:18:36+01:00</lastmod>
<priority>0.6</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/faq/5</loc>
<lastmod>2020-05-17T21:18:35+01:00</lastmod>
<priority>0.6</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/faq/0</loc>
<lastmod>2020-05-17T21:18:36+01:00</lastmod>
<priority>0.6</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/faq/1</loc>
<lastmod>2020-05-17T21:18:36+01:00</lastmod>
<priority>0.6</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/faq/3</loc>
<lastmod>2020-05-17T21:18:37+01:00</lastmod>
<priority>0.6</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/faq/4</loc>
<lastmod>2020-05-17T21:18:36+01:00</lastmod>
<priority>0.6</priority>
</url>
<url>
<loc>https://www.bewelcome.org/about/faq/6</loc>
<lastmod>2020-05-17T21:18:37+01:00</lastmod>
<priority>0.6</priority>
</url>
</urlset>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://bewelcome.org/</loc></url>
<url><loc>https://bewelcome.org/signup</loc></url>
<url><loc>https://bewelcome.org/login</loc></url>
<url><loc>https://bewelcome.org/about</loc></url>
<url><loc>https://bewelcome.org/about/getactive</loc></url>
<url><loc>https://bewelcome.org/about/thepeople</loc></url>
<url><loc>https://bewelcome.org/about/credits</loc></url>
<url><loc>https://bewelcome.org/about/statistics</loc></url>
<url><loc>https://bewelcome.org/about/commentguidelines</loc></url>
<url><loc>https://bewelcome.org/press-information</loc></url>
<url><loc>https://bewelcome.org/feedback</loc></url>
<url><loc>https://bewelcome.org/faq</loc></url>
<url><loc>https://bewelcome.org/faq/2</loc></url>
<url><loc>https://bewelcome.org/faq/4</loc></url>
<url><loc>https://bewelcome.org/faq/6</loc></url>
<url><loc>https://bewelcome.org/faq/7</loc></url>
<url><loc>https://bewelcome.org/faq/9</loc></url>
<url><loc>https://bewelcome.org/safety</loc></url>
<url><loc>https://bewelcome.org/safety/basics</loc></url>
<url><loc>https://bewelcome.org/safety/whattodo</loc></url>
<url><loc>https://bewelcome.org/safety/team</loc></url>
<url><loc>https://bewelcome.org/safety/faq</loc></url>
<url><loc>https://bewelcome.org/safety/tips</loc></url>
<url><loc>https://bewelcome.org/volunteer</loc></url>
<url><loc>https://bewelcome.org/terms</loc></url>
<url><loc>https://bewelcome.org/privacy</loc></url>
<url><loc>https://bewelcome.org/impressum</loc></url>
</urlset>
7 changes: 7 additions & 0 deletions templates/_canonical.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{# Self-referencing canonical without query string (BeWelcome/sysadmins-infra#654).
Built from the route so defaults normalise (/faq/1 and /faq share one URL).
Error pages are rendered without a route, so they get no canonical. #}
{% set canonical_route = app.request.attributes.get('_route') %}
{% if canonical_route %}
<link rel="canonical" href="{{ url(canonical_route, app.request.attributes.get('_route_params', {})) }}">
{% endif %}
1 change: 1 addition & 0 deletions templates/base-lite.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</title>

<meta name="description" content="{{ 'default_meta_description' | trans }}">
{% include '_canonical.html.twig' %}
<meta name="keywords" content="{{ 'default_meta_keyword' | trans }}">
<meta name="robots" content="{{ 'robots' | trans }}">

Expand Down
1 change: 1 addition & 0 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</title>

<meta name="description" content="{{ 'default_meta_description' | trans }}">
{% include '_canonical.html.twig' %}
<meta name="keywords" content="{{ 'default_meta_keyword' | trans }}">
<meta name="robots" content="{{ robots }}">
{% block redirect %}{% endblock %}
Expand Down
1 change: 1 addition & 0 deletions templates/home/home.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<title>BeWelcome - {{ 'home.headline.bewelcome.cultural' | trans }}</title>
<meta name="description" content="{{ 'default_meta_description' | trans }}"/>
{% include '_canonical.html.twig' %}
<meta name="keywords" content="{{ 'default_meta_keyword' | trans }}"/>

{% include 'webpreview.html.twig' %}
Expand Down
1 change: 1 addition & 0 deletions templates/profile/profile.base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</title>

<meta name="description" content="{{ 'default_meta_description' | trans }}">
{% include '_canonical.html.twig' %}
<meta name="keywords" content="{{ 'default_meta_keyword' | trans }}">
<meta name="robots" content="{{ robots }}">
{% block redirect %}{% endblock %}
Expand Down
1 change: 1 addition & 0 deletions templates/search/searchmap.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<title>{{ title }} - BeWelcome</title>
<meta name="description" content="{{ 'default_meta_description' | trans }}"/>
{% include '_canonical.html.twig' %}
<meta name="keywords" content="{{ 'default_meta_keyword' | trans }}"/>

{{ encore_entry_link_tags('bewelcome') }}
Expand Down
1 change: 1 addition & 0 deletions templates/security/login.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<title>{{ 'login' | trans }} | BeWelcome</title>

<meta name="description" content="{{ 'default_meta_description' | trans }}">
{% include '_canonical.html.twig' %}
<meta name="keywords" content="{{ 'default_meta_keyword' | trans }}">
<meta name="robots" content="{{ 'robots' | trans }}">

Expand Down
16 changes: 16 additions & 0 deletions tools/page/html.page.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,28 @@ protected function head()
<meta name="description" content="<?=$this->getPage_meta_description()?>" />
<meta name="keywords" content="<?=$this->getPage_meta_keyword()?>" />
<meta name="robots" content="<?=$this->getPage_meta_robots()?>" />
<link rel="canonical" href="<?= htmlspecialchars($this->getCanonicalUrl($baseuri), ENT_QUOTES) ?>" />
<?php
$this->includeStylesheets();
$this->includeCustomElements();
$this->_tr_buffer_header = $this->getWords()->flushBuffer();
}

/**
* Self-referencing canonical (BeWelcome/sysadmins-infra#654). Legacy pages may rely on the
* query string, so only tracking parameters are dropped.
*/
protected function getCanonicalUrl($baseuri)
{
$parts = parse_url($_SERVER['REQUEST_URI'] ?? '/');
parse_str($parts['query'] ?? '', $query);
$query = array_filter($query, function ($key) {
return !preg_match('/^(utm_.*|gclid|gbraid|wbraid|fbclid|msclkid)$/', $key);
}, ARRAY_FILTER_USE_KEY);

return rtrim($baseuri, '/') . ($parts['path'] ?? '/') . ($query ? '?' . http_build_query($query) : '');
}

protected function getPagePermalink() {
return 'index';
}
Expand Down
Loading