General Actions:
Log-in
Register
Wiki:
games
▼
:
Document Index
»
Space:
Main
▼
:
Document Index
»
Page:
SiteMap
Search
default
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
SiteMap
Wiki source code of
SiteMap
Last modified by
Adam Hattrell
on 2010/10/20 10:30
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: 2: {{groovy}} 3: if(request.xpage && request.xpage == "plain") { 4: 5: 6: response.setContentType("text/xml") 7: 8: 9: def sitePages = [ 10: // here you define the page you want in your sitemap 11: // the order is: document name, priority, change frequency 12: 13: ["Main.WebHome","1","weekly"], 14: ["AgeOfWorms.WebHome",".5","monthly"] 15: ]; 16: 17: 18: println('<?xml version="1.0" encoding="UTF-8"?>') 19: 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">') 20: 21: 22: for(page in sitePages) { 23: println("<url>") 24: println(" <loc>" + xwiki.getDocument(page[0]).getExternalURL() + "</loc>") 25: println(" <lastmod>" + xwiki.formatDate(xwiki.getDocument(page[0]).contentUpdateDate, 'yyyy-MM-dd') + "</lastmod>") 26: println(" <changefreq>" + page[2]+ "</changefreq>") 27: println(" <priority>" + page[1] + "</priority>") 28: println("</url>") 29: } 30: 31: 32: println("</urlset>") 33: 34: 35: } 36: 37: 38: else { 39: 40: 41: println("<a href='"+ doc.getURL('view','xpage=plain') +"'>Generate Sitemap</a>") 42: 43: 44: } 45: {{/groovy}}