Skip to content

Commit

Permalink
a11y: Add a sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
marienfressinaud committed Sep 3, 2024
1 parent dea6069 commit 7241397
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static function loadApp(): \Minz\Router
$router->addRoute('POST', '/contact', 'Home#sendContactEmail', 'send contact email');
$router->addRoute('GET', '/securite', 'Home#security', 'security');
$router->addRoute('GET', '/cagnotte', 'CommonPots#show', 'common pot');
$router->addRoute('GET', '/plan-du-site', 'Home#sitemap', 'sitemap');

$router->addRoute('GET', '/robots.txt', 'Home#robots', 'robots.txt');
$router->addRoute('GET', '/sitemap.xml', 'Home#sitemap', 'sitemap.xml');
Expand Down
6 changes: 5 additions & 1 deletion src/controllers/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ public function robots(Request $request): Response

public function sitemap(Request $request): Response
{
return Response::ok('home/sitemap.xml');
if ($request->path() === '/sitemap.xml') {
return Response::ok('home/sitemap.xml');
} else {
return Response::ok('home/sitemap.phtml');
}
}

public function contact(Request $request): Response
Expand Down
6 changes: 6 additions & 0 deletions src/views/_layouts/base.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@
<hr class="footer__separator">

<ul class="list--nostyle list--inline text--small text--center">
<li>
<a class="footer__link" href="<?= url('sitemap') ?>">
Plan du site
</a>
</li>

<li>
<a class="footer__link" href="<?= url('legal') ?>">
Mentions légales
Expand Down
96 changes: 96 additions & 0 deletions src/views/home/sitemap.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php
$this->layout('base.phtml', [
'title' => 'Plan du site · Flus',
'canonical' => url_full('sitemap'),
]);
?>

<nav class="layout__breadcrumb" aria-label="Fil d’Ariane">
<ul class="list--nostyle">
<li class="breadcrumb__item">
<a class="breadcrumb__link" href="<?= url('home') ?>" rel="home">

Accueil
</a>
</li>

<li class="breadcrumb__item">
<a class="breadcrumb__link" aria-current="page" href="<?= url('sitemap') ?>">

Plan du site
</a>
</li>
</ul>
</nav>

<article>
<header class="panel panel--primary panel--header">
<div class="wrapper wrapper--larger wrapper--center text--center">
<h1>
Plan du site
</h1>
</div>
</header>

<div class="panel">
<div class="wrapper wrapper--text wrapper--center text-container">
<ul class="flow flow--small">
<li>
<a href="<?= url('features') ?>">
Flus en 6 fonctionnalités
</a>
</li>

<li>
<a href="<?= url('pricing') ?>">
Le prix de Flus est le vôtre
</a>
</li>

<li>
<a href="<?= url_full('home') ?>carnet/">
Le carnet de Flus
</a>

<ul class="flow flow--small">
<li>
<a href="<?= url_full('home') ?>carnet/abonnement.html">
Suivre le carnet de Flus
</a>
</li>

<li>
<a href="<?= url_full('home') ?>carnet/markdown.html">
Guide Markdown
</a>
</li>
</ul>
</li>

<li>
<a href="<?= url('contact') ?>">
Une question&nbsp;? Une suggestion&nbsp;?
</a>
</li>

<li>
<a href="<?= url('legal') ?>">
Mentions légales
</a>
</li>

<li>
<a href="<?= url('security') ?>">
Remonter un problème de sécurité
</a>
</li>

<li>
<a href="<?= url('credits') ?>">
Crédits
</a>
</li>
</ul>
</div>
</div>
</article>

0 comments on commit 7241397

Please sign in to comment.