Newfil Xwiki

Concept:

Setup a website with some pages that can be editted by everyone (knowledge base). See excrept below.

With the goal of aggregating useful information for Filipino tertiary students at NSW, NewFil organised this knowledge base website powered by XWiki (something similar to the backend of Wikipedia). It means (most) pages here are editable by EVERYONE (provided they register). We highly encourage EVERYONE to contribute and share their Aussie and Filo know-hows for the benefit of every Filipino living here in NSW.

Challenges:

Even if the website was open to everyone, it took a lot of effort to get people writing content. The look of the website and it’s interface did not help as well. However, we did get it to a presentable level. The death blow that caused the project to stop was the cost of maintaining. We could not get more AWS credits and with the monthly cost of USD$20, it’s too heavy for a student organisation that was just beginning. I recommend the council to migrate to github pages + free wiki farm (e.g., miraheze). Although having two separate platforms is not ideal, the hosting is free!

Sitemap Generator with Xwiki

This page automatically generates this site's sitemap for SEO. The items written on the file is also displayed on the page below.

{{groovy}}
if(request.gen && request.gen == "1") {
 println("{{html}}<a href='\\sitemap.xml'>Link to sitemap.xml</a>")
}
{{/groovy}}

{{velocity}}
#set($depth = 3)
#set($limit = 100)
#set($sitePages = [])
#macro (children $parentDoc $level)
  #foreach ($child in $parentDoc.getChildren($limit, 0))
    #set ($childDoc = $xwiki.getDocument($child))
    #set ($res = $sitePages.add($childDoc))
    #if ($level < $depth)
      #children ($childDoc $mathtool.add($level, 1))
    #end
  #end
#end

#children ($xwiki.getDocument('newfil-council.WebHome') 1)
#children ($xwiki.getDocument('GeneralWelfare.WebHome') 1)
#children ($xwiki.getDocument('CulturalPromotion.WebHome') 1)
#children ($xwiki.getDocument('LearningDevelopment.WebHome') 1)
#children ($xwiki.getDocument('Contribute.WebHome') 1)
$xcontext.put("sitePages", $sitePages)
{{/velocity}}

(% class="box" %)
(((
{{groovy}}
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"],
  ["newfil-council.WebHome","1","weekly"],
  ["GeneralWelfare.WebHome","0.8","weekly"],
  ["CulturalPromotion.WebHome","0.8","weekly"],
  ["LearningDevelopment.WebHome","0.8","weekly"],
  ["Contribute.WebHome","0.8","weekly"],
 ];
 sitePagesAuto = xcontext.get("sitePages");
 print sitePagesAuto
 for (i in sitePagesAuto) {
  sitePages << [i.pageReference, "0.6", "weekly"]
 }
 content += ''
 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>"

 filename = "/var/www/html/sitemap.xml"
 file = new File(filename)
 file.write content

 print content
} else {
 print("[[Generate sitemap>>doc:||queryString=\"gen=1\"]]")
}
{{/groovy}}
)))
Avatar
Luke Sy
PhD Candidate

My research interests include state estimation, robotics, wearable sensors, machine learning, and biomedical engineering.

Next