Consortium
Activities
Projects
Forge
Events
Log-in
Register
Sitemap
Space Menu
Consortium
|
Solutions
|
Middleware
|
Forge
|
MyObjectWeb
|
PDF
|
History
|
More Actions
View
Code
|
XML
|
Help
Documentation
|
XWiki Syntax
|
1 Sitemap Under construction <% if(request.xpage && request.xpage == "plain") { response.setContentType("text/xml") def sitePages = [ // here you define the page you want in your sitemap // the order is: document name, priority, change frequency ["Main.WebHome","1","weekly"], ["Main.News","0.8","weekly"], ["Main.Documentation","0.5", "weekly"], ["Main.Demos","0.8","weekly"], ["Main.Downloads","0.5", "weekly"] // add more here... ] ]; println('<?xml version="1.0" encoding="UTF-8"?>') println('<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">') for(page in sitePages) { println("<url>") println(" <loc>" + xwiki.getDocument(page[0]).getExternalURL() + "</loc>") println(" <lastmod>" + xwiki.formatDate(xwiki.getDocument(page[0]).contentUpdateDate, 'yyyy-MM-dd') + "</lastmod>") println(" <changefreq>" + page[2]+ "</changefreq>") println(" <priority>" + page[1] + "</priority>") println("</url>") } println("</urlset>") } else { println("<a href='"+ doc.getURL('view','xpage=plain') +"'>Generate Sitemap</a>") } %> <% if(request.gen && request.gen == "1") { content = "" def sitePages = [ // here you define the page you want in your sitemap // the order is: document name, priority, change frequency ["Main.WebHome","1","weekly"], ["Main.News","0.8","weekly"], ["Main.Documentation","0.5", "weekly"], ["Main.Demos","0.8","weekly"], ["Main.Downloads","0.5", "weekly"] // add more here... ]; content += '<?xml version="1.0" encoding="UTF-8"?>' content += '<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">' for(page in sitePages) { content += "<url>" content += " <loc>" + xwiki.getDocument(page[0]).getExternalURL() + "</loc>" content += " <lastmod>" + xwiki.formatDate(xwiki.getDocument(page[0]).contentUpdateDate, 'yyyy-MM-dd') + "</lastmod>" content += " <changefreq>" + page[2]+ "</changefreq>" content += " <priority>" + page[1] + "</priority>" content += "</url>" } content += "</urlset>" new File("../webapps/xwiki/sitemap.xml").withPrintWriter { w | w.println content } println("Done: <a href='/xwiki/sitemap.xml'>sitemap.xml</a>") } else { println("<a href='"+ doc.getURL('view', "gen=1") +"'>Generate Sitemap</a>") } %>