xref: /webtrees/resources/views/modules/sitemap/sitemap-index-xml.phtml (revision b11cdcd45131b1585d66693fab363cfeb18c51a4)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Family;
6use Fisharebest\Webtrees\Individual;
7use Fisharebest\Webtrees\Media;
8use Fisharebest\Webtrees\Note;
9use Fisharebest\Webtrees\Repository;
10use Fisharebest\Webtrees\Source;
11use Fisharebest\Webtrees\Submitter;
12use Illuminate\Support\Collection;
13
14/**
15 * @var Collection<string,int> $count_families
16 * @var Collection<string,int> $count_individuals
17 * @var Collection<string,int> $count_media
18 * @var Collection<string,int> $count_notes
19 * @var Collection<string,int> $count_repositories
20 * @var Collection<string,int> $count_sources
21 * @var Collection<string,int> $count_submitters
22 * @var string                 $last_mod
23 * @var int                    $records_per_volume
24 * @var string                 $sitemap_xsl
25 */
26
27?>
28<<?php /* Beware short open tags in PHP <8.0 */ ?>?xml version="1.0" encoding="UTF-8"?>
29<<?php /* Beware short open tags in PHP <8.0 */ ?>?xml-stylesheet type="text/xsl" href="<?= e($sitemap_xsl) ?>"?>
30<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
31
32    <?php foreach ($count_families as $tree_name => $count) : ?>
33        <?php for ($i = 0; $i <= $count / $records_per_volume; ++$i) : ?>
34        <sitemap>
35            <loc>
36                <?= e(route('sitemap-file', ['tree' => $tree_name, 'type' => Family::RECORD_TYPE, 'page' => $i])) ?>
37            </loc>
38            <lastmod>
39                <?= $last_mod ?>
40            </lastmod>
41        </sitemap>
42        <?php endfor ?>
43    <?php endforeach ?>
44
45    <?php foreach ($count_individuals as $tree_name => $count) : ?>
46        <?php for ($i = 0; $i <= $count / $records_per_volume; ++$i) : ?>
47        <sitemap>
48            <loc>
49                <?= e(route('sitemap-file', ['tree' => $tree_name, 'type' => Individual::RECORD_TYPE, 'page' => $i])) ?>
50            </loc>
51            <lastmod>
52                <?= $last_mod ?>
53            </lastmod>
54        </sitemap>
55        <?php endfor ?>
56    <?php endforeach ?>
57
58    <?php foreach ($count_media as $tree_name => $count) : ?>
59        <?php for ($i = 0; $i <= $count / $records_per_volume; ++$i) : ?>
60        <sitemap>
61            <loc>
62                <?= e(route('sitemap-file', ['tree' => $tree_name, 'type' => Media::RECORD_TYPE, 'page' => $i])) ?>
63            </loc>
64            <lastmod>
65                <?= $last_mod ?>
66            </lastmod>
67        </sitemap>
68        <?php endfor ?>
69    <?php endforeach ?>
70
71    <?php foreach ($count_notes as $tree_name => $count) : ?>
72        <?php for ($i = 0; $i <= $count / $records_per_volume; ++$i) : ?>
73        <sitemap>
74            <loc>
75                <?= e(route('sitemap-file', ['tree' => $tree_name, 'type' => Note::RECORD_TYPE, 'page' => $i])) ?>
76            </loc>
77            <lastmod>
78                <?= $last_mod ?>
79            </lastmod>
80        </sitemap>
81        <?php endfor ?>
82    <?php endforeach ?>
83
84    <?php foreach ($count_repositories as $tree_name => $count) : ?>
85        <?php for ($i = 0; $i <= $count / $records_per_volume; ++$i) : ?>
86        <sitemap>
87            <loc>
88                <?= e(route('sitemap-file', ['tree' => $tree_name, 'type' => Repository::RECORD_TYPE, 'page' => $i])) ?>
89            </loc>
90            <lastmod>
91                <?= $last_mod ?>
92            </lastmod>
93        </sitemap>
94        <?php endfor ?>
95    <?php endforeach ?>
96
97    <?php foreach ($count_sources as $tree_name => $count) : ?>
98        <?php for ($i = 0; $i <= $count / $records_per_volume; ++$i) : ?>
99        <sitemap>
100            <loc>
101                <?= e(route('sitemap-file', ['tree' => $tree_name, 'type' => Source::RECORD_TYPE, 'page' => $i])) ?>
102            </loc>
103            <lastmod>
104                <?= $last_mod ?>
105            </lastmod>
106        </sitemap>
107        <?php endfor ?>
108    <?php endforeach ?>
109
110    <?php foreach ($count_submitters as $tree_name => $count) : ?>
111        <?php for ($i = 0; $i <= $count / $records_per_volume; ++$i) : ?>
112        <sitemap>
113            <loc>
114                <?= e(route('sitemap-file', ['tree' => $tree_name, 'type' => Submitter::RECORD_TYPE, 'page' => $i])) ?>
115            </loc>
116            <lastmod>
117                <?= $last_mod ?>
118            </lastmod>
119        </sitemap>
120        <?php endfor ?>
121    <?php endforeach ?>
122</sitemapindex>
123