×

You're using an outdated browser

For a better experience, keep your browser up to date. Check here for the latest version.

Manual

Using a sitemap.xml file

Jens Rutschmann (K15t Software)

Jens Rutschmann (K15t Software) Last update: Nov 16, 2018

A sitemap is a XML file that lists the URLs for a site. It allows webmasters to include additional information about each URL: when it was last updated, how often it changes, and how important it is in relation to other URLs in the site, for example. This allows search engines to crawl the site more intelligently.

Google will look for this sitemap.xml in your domain's top level directory - e.g.: http://help.k15t.com/sitemap.xml

Viewport does not support sitemaps out of the box but there are several workarounds:

Workaround 1: Dynamically generate a sitemap using a custom velocity template

You can automatically generate a sitemap with the HTML/Velocity template below. Save it as sitemap.xml.vm in your viewport theme

#set($PAGE_FILTER = [
    "sitemap.xml"
])#*
*##macro(processChildren $page)#*
    *##if (!$PAGE_FILTER.contains($page.title))#*
        *#<url>
    <loc>$page.absoluteLink</loc>
</url>
#end
    #foreach($child in $page.children)#*
        *##processChildren($child)
    #end
#end#*
*#<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    #processChildren($home)
</urlset>

To make the sitemap available, you need to create a placeholder page in the space so Scroll Viewport can handle requests to .../sitemap.xml and then tell Scroll Viewport to use the sitemap.xml.vm template from your theme to produce the sitemap on the fly.

  1. Create a page called sitemap.xml as a direct child of the home page.
  2. Add a page properties macro as follows on that page:

    The value of the property must mach the name of the template in your viewport theme.

Workaround 2: Embed Static Sitemap Content in your Viewport Theme

  1. In the space for the viewport for "/" create a new page called sitemap.xml as child of the home page
  2. In your theme's page.vm template make sure that when this page is rendered only the content of the file without any HTML tags rendered.
    • You can either add the sitemap.xml contents to your template or take it from the Confluence page.
  3. If your template has a page tree you'll want to adapt it so it filters out pages called sitemap.xml

Workaround 3: Static sitemap.xml File served by a Reverse Proxy

  1. Set up a reverse proxy in front of Confluence (Apache, Nginx, ...)
  2. Configure it to serve requests to sitemap.xml itself instead of forwarding it to Confluence. The actual configuration depends on your reverse proxy software and configuration.



2x2.12
We use cookies to create a secure and effective browsing experience for our website visitors and to understand how you use our site (i.e. Google Analytics). For more information: click here.
Ok