What's New API

Last modified by Admin on 2024/05/11 01:27

cogProvide information about what's new in XWiki
TypeJAR
CategoryAPI
Developed by

XWiki Development Team

Active Installs0
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

Since XWiki 15.1

Installable with the Extension Manager

Description

API to gather external news related to XWiki.

The following concepts are used:

  • News Source Type: The type of source of news, in the form of a component hint. For example xwikiblog represents an XWiki Blog Application news type (which means getting the news from the RSS feed generated by the XWiki Blog Application).
  • NewsSource: The actual Java object representing a new source, with the ability to filter the news and get the pieces of news (represented as NewsSourceItem).
  • NewsSourceFactory: Component used to get a NewsSource. The hint is the news source type.
  • NewsSourceDescriptor: Represents a configuration for a News Source. See the configuration section below.

See also the What's New Application which uses this API to display the news inside XWiki.

Examples

  • Get news items from a xwikiblog source, for a given user, filtered by a category:
    @Inject
    @Named("xwikiblog")
    private NewsSourceFactory factory;

    @Inject
    @Named("xwikiblog")
    private NewsConfiguration configuration;

    ...
    List<NewsSourceDescriptor> descriptors = this.configuration.getNewsSourceDescriptors();
    NewsSourceDescriptor descriptor = descriptors.get(0);
    List<NewsSourceItem> items = this.factory.create(descriptor.getParameters())
     .forUser(...)
     .forCategories(...)
     .build()
    NewsContent content = items.get(0).getDescription().get();
    String itemDescription = content.getContent();
    Syntax itemSyntax = content.getSyntax();
    ...

XWiki Blog Extension source

We have implemented a xwikiblog source type, which allows to fetch What's New news from the XWiki Blog application. To use it, follow these steps:

  • Install the XWiki Blog application in an XWiki instance
  • Configure it by adding some special Categories recognized by the What's New API, namely:

    whatsnew-blog-categories.png

  • Publish news by adding blog posts and tagging them with the What's New for XWiki category and optionally with some nested categories.
  • Configure XWiki to use it editing xwiki.properties and adding:
    whatsnew.sources = mynews = xwikiblog
    whatsnew.source.mynews.rssURL = https://(xwiki server domain)/xwiki/bin/view/Blog/CategoryRss?xpage=plain

Configuration

Defined in xwiki.properties. By default the following configuration is used:

whatsnew.sources = xwikiorg = xwikiblog
whatsnew.source.xwikiorg.rssURL = https://extensions.xwiki.org/news
whatsnew.sources = xwikisas = xwikiblog
whatsnew.sources.xwikisas.rssURL = https://xwiki.com/news

The feature can be disabled by defining an empty list of sources, as in:

whatsnew.sources = 

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.platform:xwiki-platform-whatsnew-api 16.3.1):

Get Connected