Sitemap Plugin Configuration: News Sitemap

Overview

The News Sitemap is a specialized sitemap component that generates a feed containing only news items. You can define which documents qualify as news items through the component's configuration.

This component follows the Google News sitemap specifications, ensuring that Google can process and recognize the feed. As a result, news items included in this sitemap are more likely to be discoverable in Google News search results.

The News Sitemap only includes news items published within the last 48 hours. Older items are excluded to ensure the feed remains current.

Component configuration/hst:myproject/hst:configurations/hst:default/hst:components/forge-news-sitemap-feed
Component classorg.onehippo.forge.sitemap.components.NewsSitemapFeed

Configuration

The News Sitemap component supports the following configuration parameters:

ParameterRequiredDefault ValueDescription
publicationDatePropertyyesName of the property containing the news item's publication date
documentTypesyesComma-separated list of document types to include as news items
propertyCriterianoAdditional criteria for news item selection (e.g., hippostd:state=published). Comma-separated list
timezonenoUTCTime zone for news item dates
publicationNameyesName of the site where the news item is published
publicationLanguageyesLanguage code for the news item (e.g., "en", "fr", "de")
newsInformationProvidernoorg.onehippo.forge.sitemap.generator.DefaultNewsInformationProviderFully qualified class name for a custom information provider (must extend DefaultNewsInformationProvider)

Configure the News Sitemap using the Console.

To activate the News Sitemap URL, add a sitemap item named news-sitemap.xml under /hst:myproject/hst:configurations/hst:default/hst:sitemap.

Set the hst:componentconfigurationid property to hst:components/forge-news-sitemap-feed.

Add all required configuration parameters (see the table above) to the hst:parameternames and hst:parametervalues properties.

Example configuration:

/hst:myproject/hst:configurations/hst:default/hst:sitemap: /news-sitemap.xml: jcr:primaryType: hst:sitemapitem hst:componentconfigurationid: hst:components/forge-news-sitemap-feed hst:parameternames: [ documentTypes,\ \ publicationDateProperty,\ \ publicationName,\ \ publicationLanguage ] hst:parametervalues: [ myproject:newsdocument,\ \ myproject:date,\ \ My Project,\ \ en ]

Verification

After configuring the News Sitemap, access the feed at:

http://localhost:8080/site/news-sitemap.xml

A valid news sitemap feed appears as follows:

<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"> <url> <loc>http://localhost:8080/site/news/2018/11/the-medusa-news.html</loc> <lastmod>2013-11-12T13:04:00+01:00</lastmod> <news:news> <news:publication> <news:language>en</news:language> <news:name>My Project</news:name> </news:publication> <news:publication_date>2018-11-26T09:52:00+13:00</news:publication_date> </news:news> </url> <url> <loc>http://localhost:8080/site/news/2018/11/2013-harvest.html</loc> <lastmod>2013-11-12T14:31:00+01:00</lastmod> <news:news> <news:publication> <news:language>en</news:language> <news:name>My Project</news:name> </news:publication> <news:publication_date>2018-11-26T09:52:00+13:00</news:publication_date> </news:news> </url> <url> <loc>http://localhost:8080/site/news/2018/11/the-gastropoda-news.html</loc> <lastmod>2013-11-12T12:52:00+01:00</lastmod> <news:news> <news:publication> <news:language>en</news:language> <news:name>My Project</news:name> </news:publication> <news:publication_date>2018-11-26T09:52:00+13:00</news:publication_date> </news:news> </url> </urlset>.

Note: Some browsers may not display the sitemap as XML. To view the raw XML, use your browser's "View Page Source" option.

Share Feedback
Page: /build/plugins/sitemap/news-sitemap
Section: Build
Category *