[opencms-dev] Google Sitemap Script/Plugin for OpenCms

Joe Desbonnet jdesbonnet at gmail.com
Fri Sep 8 17:36:03 CEST 2006


I've got a script that generates a human readable sitemap -- it sould
be easy to adapt that to generate the necessary XML instead. There is
the script for generating a HTML sitemap:


<%@
page session="false"
import="java.util.*"
import="org.opencms.jsp.*"
import="org.opencms.file.*"
%><%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<%!
public void buildSiteMap(org.opencms.jsp.CmsJspActionElement cms,
String uri, java.io.Writer out) throws Exception {

String desc;
List navList = cms.getNavigation().getNavigationForFolder(uri);

if (navList.size() > 0) {

	out.write("<ul>\n");

	Iterator navItem = navList.iterator();
 	CmsJspNavElement nav;
 	String target;
	while (navItem.hasNext()) {
		nav = (CmsJspNavElement) navItem.next();
		if (nav != null) {
			target = nav.getResourceName();
        		out.write("<li>");

			if (nav.isFolderLink()) {
				target = cms.link(target + "index.html");
			} else {
				target = cms.link(target);
			}

			out.write("<a href=\"" + target + "\">");
			out.write(nav.getNavText());

			out.write("</a>\n");
			desc = nav.getDescription();
 			if (desc != null) {
				out.write("  " + desc);
			}
			if (nav.isFolderLink()) {
				buildSiteMap(cms, nav.getResourceName(), out);
			}

		}
	}

	out.write("</ul>\n");
}
}
%>

<cms:include property="template" element="head" />
<h1>Site Map</h1>
<p> </p>

<%
	CmsJspActionElement cms = new CmsJspActionElement (pageContext,
request, response);
	buildSiteMap(cms, "/", out);
%>
<cms:include property="template" element="foot" />






On 9/8/06, Uhlig, Roman  Knuepfer Verlag <roman.uhlig at knve.de> wrote:
>
> Is anybody currently developing a script or plugin for creating Google
> sitemaps within OpenCms? I'd really like to see it in this list for
> supported CMS:
>
> http://code.google.com/sm_thirdparty.html
>
>
> Roman
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list