Skip to content

Feed format

The feed is a JSON Feed 1.1, with the same keys as Drupal.org's announcements feed, which core's Announcements module reads. The Platform Announcements Source submodule publishes one, but any JSON Feed works.

{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "Platform announcements",
  "items": [
    {
      "id": "0c9a5b6e-3f1d-4a8b-9e27-5d4c8f1a2b3c",
      "title": "Scheduled maintenance on Saturday",
      "url": "https://www.example.com/announcements/scheduled-maintenance",
      "content_html": "<p>Sites will be read-only from 8 to 10 AM.</p>",
      "date_published": "1984-01-01T00:00:00+00:00",
      "date_modified": "1984-01-02T00:00:00+00:00",
      "_drupalorg": {
        "featured": true
      }
    }
  ]
}

Item keys

Key Required Used for
id Yes Telling announcements apart, including which ones were dismissed. Keep it the same for the life of the announcement: a new id brings back a dismissed announcement.
title Yes The announcement's title, as plain text.
url Yes The link to the full announcement.
content_html No A short description, as HTML. It's filtered with Drupal's admin XSS filter before it's shown.
date_published No The date shown with the announcement.
date_modified No When the announcement was last updated. A dismissed announcement comes back when this changes. Defaults to date_published.
_drupalorg.featured No true to show the announcement before the others.

Items without an id, title or url are skipped. So are items whose url is on another host than the feed's own URL, as core's Announcements module only keeps links to Drupal.org.

The feed is cached for the max_age setting (a day by default), fetched again on cron once that expires, and at once when the feed URL changes. Only the first limit items (10 by default) are shown, with featured items moved to the top.

Publishing the feed from a view

The Platform Announcements Source submodule's view uses the Announcements JSON Feed style (platform_announcements_json_feed). Its settings map the view's fields to the item keys above:

  • Title field, Content field, URL field and Published date field are required.
  • Updated date field is optional: leave it empty to use the published date.
  • Featured field is optional: a boolean field, or empty to feature none.

Feed title sets the feed's own title.

Each item's id is the content's UUID, so changing its URL alias or the source site's domain doesn't bring back dismissed announcements. The style only works with views of entities, such as content: rows that aren't entities are left out of the feed.