xref: /webtrees/resources/views/modules/sitemap/sitemap-file-xml.phtml (revision 43f2f523bcb6d4090564d23802872c0679ede6bc)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\GedcomRecord;
6use Fisharebest\Webtrees\Http\RequestHandlers\TreePage;
7use Fisharebest\Webtrees\Tree;
8use Illuminate\Support\Collection;
9
10/**
11 * @var float                    $priority
12 * @var Collection<GedcomRecord> $records
13 * @var string                   $sitemap_xsl
14 * @var Tree                     $tree
15 */
16
17?>
18<<?php /* Beware short open tags in PHP <8.0 */ ?>?xml version="1.0" encoding="UTF-8"?>
19<<?php /* Beware short open tags in PHP <8.0 */ ?>?xml-stylesheet type="text/xsl" href="<?= e($sitemap_xsl) ?>"?>
20<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
21    <url>
22        <loc><?= e(route(TreePage::class, ['tree' => $tree->name()])) ?></loc>
23        <priority>1.0</priority>
24    </url>
25    <?php foreach ($records as $record) : ?>
26        <url>
27            <loc><?= e($record->url()) ?></loc>
28            <priority><?= e($priority) ?></priority>
29            <?php if ($record->facts(['CHAN'])->isNotEmpty()) : ?>
30                <lastmod><?= $record->facts(['CHAN'])->first()->date()->minimumDate()->Format('%Y-%m-%d') ?></lastmod>
31            <?php endif ?>
32        </url>
33    <?php endforeach ?>
34</urlset>
35
36
37