123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- [% USE site = XML::Simple(
- 'sitemap.xml'
- ForceArray = ['page']
- KeyAttr = ['' ]
- )
- %]
- [% INCLUDE explore node=site;
- BLOCK explore;
- # nodes is already set by breadcrumbs.tmpl
- PROCESS crumblist urllist=[] cnode=nodes.0;
- itemcount = 0;
- 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 == '.') ? toplink : "$toplink$page.url";
- END;
- ELSE;
- # add page id to current path to get page path
- page.path = "$toplink$path/$page.id";
- # add suffix for a section (/index.html) or page (.html)
- suffix = page.page ? '/index.en.html' : '.en.html';
- page.url = "${page.path}${suffix}";
- END;
- # add complete URL to sitemap lookup table
- site.url2page.${page.url} = page;
- t_url = "$toplink${template.name}"|replace('/index.html|/index.en.html','/')|replace('.html|.en.html','');
- in_list = 0;
- FOREACH url IN urllist;
- IF page.path == "$toplink$url";
- in_list = 1;
- END;
- END;
- IF !page.hide || in_list;
- IF itemcount == 0;
- node == site ? "<ul id=\"nav\">" : "\n<ul>";
- "\n";
- END;
- itemcount = itemcount + 1;
- # print some debugging info
- # "page: $page.id\n path: $page.path\n url: $page.url\n" | stderr;
- "\t<li><a href=\"$page.path\">$page.title</a>";
- # process and child nodes
- INCLUDE explore node=page path=page.path
- IF page.page AND (t_url.match("^$page.path") OR in_list);
- "</li>\n";
- END;
- END;
- IF itemcount > 0;
- "</ul>\n";
- END;
- END;
- BLOCK crumblist;
- IF cnode && cnode.getName() == "page";
- urllist.push(cnode.getAttribute("url"));
- PROCESS crumblist cnode=cnode.getParentNode();
- END;
- END;
- %]
|