web/sitemap.php
changeset 1558 761ba7426984
child 1562 27db60397462
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/sitemap.php	Tue Sep 03 11:09:40 2024 +0200
@@ -0,0 +1,56 @@
+<?php
+
+include_once dirname(__FILE__).'/common.php';
+
+
+function addURL($relURL) {
+
+    echo("<url><loc>".URL_ROOT.$relURL."</loc></url>\n");
+}
+
+function get_archive_path($root, $path) {
+    $res = array();
+
+    include("$root/$path/config.php");
+
+    if(isset($config['event_list']) && !empty($config['event_list']) ) {
+        array_push($res, "$path/select.php");
+        foreach($config['event_list'] as $event) {
+            array_push($res, "$path/$event/polemicaltimeline.php");    
+        }
+    } else {
+        array_push($res, "$path/polemicaltimeline.php");
+    }
+
+    return $res;
+}
+
+header('Content-Type: text/xml; charset=UTF-8');
+echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
+
+?>
+<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
+<?php
+addURL("");
+addURL("about.php");
+addURL("archives.php");
+
+$archives=array ();
+
+for($i=0;$i<count($archives_list);$i++) {
+    
+    $archive_ref = $archives_list[$i];
+    $archive_name = $archive_ref;
+    if(is_array($archive_ref)) {
+        $archive_name = $archive_ref[0];
+    }
+    $archives = array_merge($archives,get_archive_path(dirname(__FILE__), $archive_name));
+}
+
+foreach ($archives as $archPath) {
+    addURL($archPath);
+}
+
+?>
+</urlset>
+