SeaMonkey Site Map
[% USE site = XML::Simple(
'sitemap.xml'
ForceArray = ['page']
KeyAttr = ['' ]
)
%]
[% INCLUDE smap node=site;
BLOCK smap;
"\n";
FOREACH page IN node.page;
IF page.url;
IF page.url.match("^http://") OR page.url.match("^https://");
page.path = page.url;
ELSE;
page.path = (page.url == '.') ? '/' : "/$page.url";
END;
ELSE;
# add page id to current path to get page path
page.path = "$path/$page.id";
# add suffix for a section (/index.html) or page (.html)
suffix = page.page ? '/index.html' : '.html';
page.url = "${page.path}${suffix}";
END;
# add complete URL to sitemap lookup table
site.url2page.${page.url} = page;
# print some debugging info
# "page: $page.id\n path: $page.path\n url: $page.url\n" | stderr;
"\t- $page.title";
# process and child nodes
INCLUDE smap node=page path=page.path
IF page.page;
"
\n";
END;
"
\n";
END;
%]