Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
18.1 | 1 | {{groovy}} |
| |
21.1 | 2 | /* |
| |
18.1 | 3 | if (xcontext.action == "get") { |
| 4 | response.setContentType("text/xml") | ||
| 5 | |||
| |
18.2 | 6 | def docs = services.query.xwql('where doc.space like Collabs').execute() |
| 7 | |||
| |
18.1 | 8 | def sitePages = [ |
| 9 | // here you define the page you want in your sitemap | ||
| 10 | // the order is: document name, priority, change frequency | ||
| 11 | ["Main.WebHome","1","weekly"], | ||
| 12 | ["About.Contact","0.8","monthly"], | ||
| 13 | ["About.Team","0.5", "monthly"] | ||
| 14 | // add more here... | ||
| 15 | ] | ||
| 16 | |||
| 17 | println('') | ||
| 18 | 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">') | ||
| 19 | |||
| |
18.2 | 20 | for (doc in docs) { |
| |
18.1 | 21 | println("<url>") |
| 22 | println(" <loc>" + xwiki.getDocument(page[0]).getExternalURL() + "</loc>") | ||
| 23 | println(" <lastmod>" + xwiki.formatDate(xwiki.getDocument(page[0]).contentUpdateDate, 'yyyy-MM-dd') + "</lastmod>") | ||
| |
18.2 | 24 | //println(" <changefreq>" + page[2]+ "</changefreq>") |
| 25 | //println(" <priority>" + page[1] + "</priority>") | ||
| |
18.1 | 26 | println("</url>") |
| 27 | } | ||
| 28 | |||
| 29 | println("</urlset>") | ||
| 30 | } else { | ||
| 31 | println("{{html}}<a href='"+ doc.getURL('get','outputSyntax=plain') +"'>Generate Sitemap</a>{{/html}}") | ||
| 32 | } | ||
| |
21.1 | 33 | */ |
| |
18.1 | 34 | {{/groovy}} |
| 35 | |||
| 36 | |||
| |
4.1 | 37 | {{velocity}} |
| |
23.1 | 38 | #if ($xcontext.action == "get") |
| |
24.1 | 39 | $response.setContentType("text/xml") |
| |
21.1 | 40 | #set ($spaceReferenceString = 'Collabs') |
| 41 | #set ($query = $services.query.xwql("where doc.space like :space")) | ||
| |
33.2 | 42 | #set ($query = $query.bindValue('space').literal("${spaceReferenceString}.").anyChars().query()) |
| |
33.3 | 43 | #set ($resources = $query.setLimit(10).execute()) |
| |
32.1 | 44 | <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"> |
| |
28.1 | 45 | #foreach ($resource in $resources) |
| |
30.1 | 46 | #set($page = $xwiki.getDocument($resource)) |
| 47 | <url> | ||
| |
33.5 | 48 | <doc>$page.object</doc> |
| |
30.1 | 49 | <loc>$page.getExternalURL()</loc> |
| 50 | <lastmod>$xwiki.formatDate($page.contentUpdateDate, 'yyyy-MM-dd')</lastmod> | ||
| 51 | </url> | ||
| |
28.1 | 52 | #end |
| |
32.1 | 53 | </urlset> |
| |
24.1 | 54 | #else |
| |
26.1 | 55 | {{html}}<a href="$doc.getURL('get','outputSyntax=plain')">Generate Sitemap</a>{{/html}} |
| |
23.1 | 56 | #end |
| |
4.1 | 57 | {{/velocity}} |