<%@ page import="org.opencms.jsp.*, org.opencms.file.*, java.util.*, java.text.*, java.util.zip.*, java.io.*" %><%
  String domain = "http://www.moossen.net/";
  CmsObject cms = new CmsJspActionElement(pageContext, request, response).getCmsObject();
  SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
  String today = df.format(new Date());
  PrintWriter pw = new PrintWriter(new GZIPOutputStream(response.getOutputStream()), false);
  pw.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"><url><loc>";
  pw.print(domain);
  pw.print("index.html</loc><lastmod>");
  pw.print(today);
  pw.print("</lastmod><changefreq>daily</changefreq><priority>1</priority></url>");

CmsResourceFilter filter = CmsResourceFilter.DEFAULT_FILES;
filter = filter.addExcludeType(3); // exclude images
Iterator it = cms.readResources("/", filter).iterator();
while (it.hasNext()) {
    CmsResource res = (CmsResource)it.next();
	boolean inSitemap = true; // DIY: filter the resources for the sitemap
    if (!inSitemap) {
        continue;
    }
    String uri = cms.getSitePath(res);
    String prio = "1";
    String freq = "daily";
	boolean isContent = false; // DIY: some different type of files
	boolean isStatic = false;
    if (isContent) {
       freq = "monthly";
       prio = "0.8";
    } else if (isStatic) {
       freq = "yearly";
       prio = "0.5";
    }
    String date = today;
    date = df.format(new Date(res.getDateLastModified()));
	pw.print("<url><loc>");
	pw.print(domain + uri);
	pw.print("</loc><lastmod>");
	pw.print(date);
	pw.print("</lastmod><changefreq>");
	pw.print(freq);
	pw.print("</changefreq><priority>");
	pw.print(prio);
	pw.print("</priority></url>");
}
pw.print("</urlset>");
pw.close();
%>