Search code examples
gradlesitemapdocbook

How to create sitemap.xml from docbook source


I need to generate sitemap.xml in the standard Google acceptable format from my docbook source. I'm currently using gradle to power the build process.

Is there an existing tool out there to generate sitemap.xml automatically as part of the build?


Solution

  • By Using Ant from Gradle is seams to be possible as there is an Apache Ant Task for generating a XML Sitemap. Read the manual at GitHub, for the usage details.

    <target name="generate_sitemap" description="generates the sitemap">
        <taskdef classname="uk.co.arjones.ant.task.Sitemap" name="sitemap"></taskdef>
        <sitemap url="http://organisation.org" gzip="yes" lastmod="now" destdir="${BUILD_DIR}">
            <fileset dir="${BUILD_DIR}">
                <include name="**.docbook"></include>
                <include name="**.dbx"></include>
                <exclude name="google*"></exclude>
            </fileset>
        </sitemap>
    </target>