query( 'SELECT b.slug AS brand_slug, m.slug AS model_slug, m.updated_at FROM car_models m JOIN brands b ON b.id = m.brand_id' )->fetchAll(); $brands = $db->query('SELECT slug, updated_at FROM brands')->fetchAll(); // Im Dashboard ausgeblendete Bereiche leiten auf die Startseite um - gehoeren nicht in die Sitemap. $vehiclesHidden = SiteSettingsController::isHidden('page.vehicles'); if ($vehiclesHidden) { $models = $brands = []; } $urls = [['loc' => '/', 'priority' => '1.0']]; if (!$vehiclesHidden) { $urls[] = ['loc' => '/fahrzeuge', 'priority' => '0.9']; } $urls[] = ['loc' => '/kontakt', 'priority' => '0.5']; // Passwortgeschuetzt zeigt die Seite nur ein Eingabefeld - nichts, was ein Suchmaschinen- // Eintrag wert waere. if (DownloadController::hasVisible() && !DownloadController::isProtected() && !SiteSettingsController::isHidden('page.downloads')) { $urls[] = ['loc' => '/downloads', 'priority' => '0.4']; } foreach ($brands as $brand) { $urls[] = ['loc' => "/fahrzeuge/{$brand['slug']}", 'priority' => '0.8', 'lastmod' => $brand['updated_at']]; } foreach ($models as $model) { $urls[] = [ 'loc' => "/fahrzeuge/{$model['brand_slug']}/{$model['model_slug']}", 'priority' => '0.7', 'lastmod' => $model['updated_at'], ]; } if (!SiteSettingsController::isHidden('page.services')) { $urls[] = ['loc' => '/leistungen', 'priority' => '0.8']; } if (!SiteSettingsController::isHidden('page.gallery')) { $urls[] = ['loc' => '/galerie', 'priority' => '0.6']; $galleryBrands = $db->query('SELECT slug, updated_at FROM gallery_brands')->fetchAll(); foreach ($galleryBrands as $galleryBrand) { $urls[] = ['loc' => "/galerie/{$galleryBrand['slug']}", 'priority' => '0.5', 'lastmod' => $galleryBrand['updated_at']]; } $galleryProjects = $db->query( 'SELECT gb.slug AS brand_slug, gp.slug AS project_slug, gp.updated_at FROM gallery_projects gp JOIN gallery_brands gb ON gb.id = gp.gallery_brand_id' )->fetchAll(); foreach ($galleryProjects as $project) { $urls[] = [ 'loc' => "/galerie/{$project['brand_slug']}/{$project['project_slug']}", 'priority' => '0.5', 'lastmod' => $project['updated_at'], ]; } } foreach (['/impressum', '/datenschutz', '/agb'] as $legalPath) { $urls[] = ['loc' => $legalPath, 'priority' => '0.2']; } header('Content-Type: application/xml; charset=utf-8'); echo '' . "\n"; echo '' . "\n"; foreach ($urls as $url) { echo " \n"; echo ' ' . htmlspecialchars($siteUrl . $url['loc']) . "\n"; if (!empty($url['lastmod'])) { echo ' ' . date('Y-m-d', strtotime($url['lastmod'])) . "\n"; } echo ' ' . $url['priority'] . "\n"; echo " \n"; } echo '';