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