mirror of
https://github.com/YGGverse/YGGwave.git
synced 2026-03-31 09:45:32 +00:00
add sitemap
This commit is contained in:
parent
e47434f98d
commit
6144699c99
2 changed files with 28 additions and 0 deletions
3
robots.txt
Normal file
3
robots.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
User-agent: *
|
||||
|
||||
Sitemap: /sitemap.php
|
||||
25
sitemap.php
Normal file
25
sitemap.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
header('Content-type: application/xml; charset=utf-8');
|
||||
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
echo '<urlset>';
|
||||
|
||||
if ($signals = file_get_contents('SIGNALS/YGGDRASIL.md')) {
|
||||
|
||||
foreach (explode(PHP_EOL, $signals) as $signal) {
|
||||
|
||||
if (preg_match('/\[(.*?)\]\((.*?)\)/ui', $signal, $data)) {
|
||||
|
||||
if (!empty($data[1]) && !empty($data[2])) {
|
||||
|
||||
if ($host = parse_url($data[2], PHP_URL_HOST)) {
|
||||
|
||||
echo sprintf('<url><loc>%s</loc></url>', htmlentities($data[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '</urlset>';
|
||||
Loading…
Add table
Add a link
Reference in a new issue