version 0.8.0
This commit is contained in:
parent
f22007003a
commit
e5ca9ef194
95 changed files with 5601 additions and 4042 deletions
26
app/Controllers/Pages/SitemapController.php
Normal file
26
app/Controllers/Pages/SitemapController.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** Dynamische sitemap.xml (Domain wird automatisch erkannt). */
|
||||
final class SitemapController extends Controller
|
||||
{
|
||||
public function xml(): void
|
||||
{
|
||||
header('Content-Type: application/xml; charset=utf-8');
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$base = $scheme . '://' . ($_SERVER['HTTP_HOST'] ?? 'localhost');
|
||||
|
||||
// Nur indexierbare Inhaltsseiten (App-Seiten sind noindex)
|
||||
$paths = [
|
||||
'/', '/regeln', '/spielanleitung', '/strategie', '/spielvarianten',
|
||||
'/faq', '/partyspiele', '/datenschutz', '/impressum',
|
||||
];
|
||||
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
||||
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
||||
foreach ($paths as $p) {
|
||||
echo ' <url><loc>' . htmlspecialchars($base . $p, ENT_QUOTES) . '</loc></url>' . "\n";
|
||||
}
|
||||
echo '</urlset>' . "\n";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue