Summary | Generates a sitemap file |
---|---|
Short name | sitemap |
Path patterns defined via /default.metainfo | /**/*.sitemap |
Provided by bundle | built-in |
API doc | Webgen::PathHandler::Sitemap |
Description
This path handler automatically generates a sitemap based on the specification of http://sitemaps.org from a path in Webgen Page Format. Sitemaps are used for informing search engines about pages on a site. Therefore a webgen website should have at least one sitemap.
Usage
A sitemap path for webgen has to be in Webgen Page Format and only needs to contain a meta
information block. The extension sitemap
is automatically changed to xml
for the destination
path and canonical name.
The website.base_url configuration option needs to be set so that this path handler can correctly generate absolute URLs.
After a sitemap has been created and published, search engines need to be made aware of it. Have a look at the respective section on the Sitemap protocol page.
Also read the section about the possible locations of a Sitemap file because not all URLs are allowed in all Sitemap files!
Special Meta Information Keys for Sitemap Nodes
- entries (mandatory)
- A node finder option set which specifies the paths that should be included in the sitemap.
Note that the resulting node set is flattened even if the ‘flatten’ option is not used.
- default_change_freq (optional)
- The default change frequency of a path. This is used for paths that do not have the change_freq
meta information set.
This value is set to ‘weekly’ by default via the
/default.metainfo
path. - default_priority (optional)
- The default priority of a path. This is used for paths that do not have the priority meta
information set.
This value is set to ‘0.5’ by default via the
/default.metainfo
path.
Meta Information Keys of Entry Nodes Used in a Sitemap
- modified_at
- Used for the last modification time of the sitemap entry.
See the <lastmod> tag definition for more information.
- change_freq
- Used for the change frequency of the sitemap entry.
See the <changefreq> tag definition for more information.
- priority
- The priority of the path in respect to the other path in the sitemap.
See the <priority> tag definition for more information.
Sitemap Templates
webgen ships a template /templates/sitemap.template
for the generation of the XML sitemap. This
template needs to contain a sitemap block which is used for rendering the sitemap.
It is possible to customize the generated sitemap files by adding a sitemap block to the sitemap
node itself or by customizing the /templates/sitemap.template
template.
Example
Here is an example for the content of a sitemap path:
---
entries:
alcn: /**/*.html
default_change_freq: daily
default_priority: 0.2
---
Note that there is no content block but only a meta information block with the special meta information keys that are needed.