Sitemap Plugin Configuration: News Sitemap

Description

The News Sitemap is an alternative sitemap component that includes only news items in the sitemap feed. Which documents are considered "news items" can be specified in the component configuration.

The News Sitemap component complies with the specifications provided by Google, which means that Google accepts and recognizes the news sitemap feed. This will lead to better (i.e. higher percentage) findability of the news items in Google.

News items which are older than 48 hours will not be included in the news sitemap feed. This means that each resolved news item in the news sitemap feed is topical.

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

Configuration

The News Sitemap component provides the following configuration parameters:

Parameter Required Default Value Description
publicationDateProperty yes   Property in which the date of a news item is stored
documentTypes yes   Document types which are considered news items (comma separated list)
propertyCriteria no   Extra criteria which a news item must satisfy (e.g. the document has to be published: hippostd:state=published). The criteria are comma separated
timezone no UTC The time zone of the news item.
publicationName yes   Name of site on which the news item is published
publicationLanguage yes   Language of the news item (e.g. "en", "fr", "de" etc.)
newsInformationProvider no org.onehippo.forge.sitemap.generator.DefaultNewsInformationProvider Location of custom class (which extends the DefaultNewsInformationProvider class of the sitemap plugin)

Use the Console to configure the News Sitemap.

Activate the URL for the News Sitemap by adding a sitemap item news-sitemap.xml to /hst:myproject/hst:configurations/hst:default/hst:sitemap.

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

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

Example:

/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 ]

Point your browser to  http://localhost:8080/site/news-sitemap.xml to see your site's news sitemap feed:

<?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: your browser may not display the sitemap as XML. View the page source to see the sitemap XML.
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?