2
0
mirror of https://github.com/boostorg/website.git synced 2026-01-19 16:52:15 +00:00
Files
website/sitemap.xml.php
Daniel James 40688e1552 Update links for https
Mostly in comments. Might be better to use relative links from html.
2018-04-13 09:14:48 +01:00

48 lines
1.1 KiB
PHP

<?php
require_once(dirname(__FILE__) . '/common/code/bootstrap.php');
header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>', "\n";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php
// Returns true if the library is part of the current release of boost.
function xmlentities($text) {
return str_replace(
array('&', '<', '>', '"', "'"),
array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;'),
$text);
}
function echo_sitemap_url($loc, $priority, $freq) {
$loc_xml = isset($_SERVER['HTTP_HOST']) ?
xmlentities("http://{$_SERVER['HTTP_HOST']}/{$loc}") :
xmlentities("https://www.boost.org/{$loc}");
echo <<<EOL
<url>
<loc>$loc_xml</loc>
<priority>$priority</priority>
<changefreq>$freq</changefreq>
</url>
EOL;
}
// Library list
echo_sitemap_url("doc/libs/", '1.0', 'daily');
// Library 'home pages'
$libs = BoostLibraries::load();
// TODO: Include hidden libraries? Or not?
foreach ($libs->get_for_version(BoostVersion::current()) as $lib) {
echo_sitemap_url("doc/libs/release/$lib[documentation]", '1.0', 'daily');
}
?>
</urlset>