Using Media Feeds, you can stream dynamic content from the Content Repository and make it available to website visitors in a dedicated channel. You can select the format in which the content is rendered in order to optimize it for a wide variety of devices and web services. Media Feeds work in much the same way as the Dynamic Content Overview Element: you can specify which content items to include, define a publication date range, specify tags, and control the sort order and how many results to show at a time. However, unlike a Dynamic Content Overview content element, the results returned by a Media Feed are shown in a separate channel (URL).
The formats that are available for Media Feeds are JSON, Media RSS, and RSS 2.0. These three options make it possible for you to select the best format for the content items that are returned by the Media Feed. The design template used to render the content in a Media Feed (MediaFeed) can also be modified in order to optimize the visual appearance of the results that are shown. Because a Media Feed is accessed through a URL that is relative to the root address of your website, you can define a public friendly URL that is intuitive and makes clear what the content is (/feed/articles
, /feed/multimedia
and /feed/mobile
, for example).
A Media Feed can display the following content item types:
- Article
- Download
- Image
- Multimedia
- Custom media items
- Page (saved in the Content Repository)
In order for a content item to be available in a Media Feed, it must be in a published state and not have any personalization(s) assigned to it.
In This Topic
Creating a Media Feed
To create a Media Feed, follow these steps:
- Navigate to Configuration > Media Feeds.
Define the following properties for the Media Feed:
Property Description Media Feed Name The title of the Media Feed. This string appears above the content items on the website frontend. Media Feed URL The URL of the Media Feed. The URL you specify is suffixed to your website URL. For example, if your website URL is "www.gxsoftware.com" and you enter "articles" in the "Media Feed URL" field, the Media Feed is available at the URL
"www.gxsoftware.com/web/feed/articles".Format The format of the Media Feed. The options are: - JSON Feed - The Media Feed is returned in JSON format.
- Media RSS Feed - The Media Feed is in the XperienCentral Media RSS Feed format.
- RSS 2.0 Feed - The Media Feed is in RSS 2.0 Feed format.
Content Types Select which content types you want to include in the Media Feed. All Tags If you want to only include content items that match all the tags you specify, click [Select] and add the tags.. One or More Tags If you want to include all content items that match any of the selected tags you specify, click [Select] and then add the tags. Without Tags If you want to include all content items that do not have the specified tag, click [Select] and then add the tag(s) that will exclude content item(s) from the Media Feed. Publication Date Allows you to specify a publication date range for the content items that are included in the Media Feed. Only those content items that were published during the date range you specify will be included in the Media Feed. Show content from the last x days Allows you to narrow the range of content items in the Media Feed to those no older than x number of days. Show Results The Media Feed will only show the number of results specified. Sort by Specifies how the Media Feed sorts the content items. The options are: - Publication date
- Most reactions
- Voting models
- Most viewed
- Alphabetic
- Last post
- Modification date
Order by Specifies how to order the results. The options are:
- Newest/highest first
- Oldest/lowest first
Show content items on Specifies the page on which media items are shown when clicked by the website visitor. The options are:- "Display on" page of the media item
- Select a page from the site structure on which media items will be displayed.
See Working with Language Versions in XperienCentral for general information about maintaining multiple language versions of a channel.
Click [Apply]. The Media Feed is now available at the specified URL.
Deleting a Media Feed
To delete a Media Feed, follow these steps:
- Select the Media Feed you want to delete from the drop-down list.
- Click [Delete Media Feed] next to "Media Feed Name".
- Click [OK] to confirm the action.
Building a Media Feed URL
The following applies to XperienCentral versions 10.23.0 and higher.
You can configure the content of a Media Feed by adding parameters to its URL. This makes it possible to create a custom Media Feed on the fly. The following parameters are supported in a Media Feel URL:
Parameter | Description |
---|---|
any, all, not | Specifies the media items to include based on assigned tags. For example, the URL
would return all media items containing the tags |
from, to | Specifies the number of results to return. For example, the URL
would return items 1 through 5. |
sort | Sorts the results according to the following parameters:
For example, the URL
would return all media items with the tag |
order | Sorts the results in ascending (
would return all media items with the tag |
contenttypes | Specifies the media items to include based on their type. The type options are:
For example, the URL
would return all media items of type |
XperienCentral Headless
XperienCentral Headless is a hybrid version of XperienCentral Traditional which contains a subset of the full set of licensed components as well as a rich text editor that does not show you a representation of what content items look like when presented on a website frontend. In XperienCentral Headless content is delivered in JSON format and no direct styling is performed. This functionality can be used to compliment Media Feeds. See XperienCentral Headless for complete information.
The following applies to XperienCentral versions R43 and higher.
Creating a Custom Media Feed Listener
The Media Feed functionality is a simple mechanism to prresent a list of content items to a website visitor. In some XperienCentral projects it is desirable to have a mechanism that overrides and or improves the basic mechanism. By adding a listener mechanism you can implement a specific interface and take control over the Media Feed output. The listener makes it possible to
- Overrule the method that retrieves the content items from XperienCentral.
- Overrule the
MediaItemFilter
instance that is used for default retrieval of items. - Overrule the
MediaItemSortOptions
instance that is used for default sorting of items. - Perform custom filtering on the retrieved items (given the items, filter options and sort options).
- Determine which
queryString
parameters should be passed on to the Media Feed JSP.
The following is an example of a custom plugin that implements a listener that overrides the default Media Feed functionality. Click
to download the full source of this custom plugin./* * Copyright (C) 1998 - 2020 GX Software B.V. All rights reserved. The contents of this * work is confidential. It is prohibited to copy, duplicate or alter this work in any * manner without the express prior written approval of GX Software B.V. */ package com.gxwebmanager.solutions.examplepresentation.service; import nl.gx.product.wmpmediafeed.api.FeedListenerBase; import nl.gx.webmanager.cms.mediarepository.*; import nl.gx.webmanager.foundation.Session; import nl.gx.webmanager.services.contentapi.MediaRepositoryManagementService; import nl.gx.webmanager.services.sessionmanager.SessionManager; import javax.servlet.http.HttpServletRequest; import java.util.*; import java.util.logging.Logger; /** * * ExampleFeedListener * */ public class ExampleFeedListener extends FeedListenerBase { private static final Logger LOG = Logger.getLogger(ExampleFeedListener.class.getName()); private MediaRepositoryManagementService myMediaRepositoryManagementService; private SessionManager mySessionManager; /** * {@inheritDoc} */ public String getIdentifier() { return "Example Feed listener"; } /** * {@inheritDoc} */ public List<MediaItem> getMediaItems(HttpServletRequest request, MediaItemFilter filter, MediaItemSortOptions sortOptions) { LOG.warning("getMediaItems from ExampleFeedListener: return only first 3 items"); List<MediaItem> items = new ArrayList<>(); Session session = mySessionManager.getActiveSession(); boolean sessionCreated = false; if (session == null) { session = mySessionManager.createSession(request, null); sessionCreated = false; } try { //We should ignore the existing items but do a proper query ourselves int from = filter.getResultFrom(); int to = filter.getResultTo(); // retrieve everything filter.setResultRange(0,3); MediaSearchResult searchResult = myMediaRepositoryManagementService.getMediaItems(session.getContext().getWebsite(), filter, sortOptions); LOG.warning("getMediaItems from ExampleFeedListener: query returned "+searchResult.getCount()+" items, but we only use first 3 items"); MediaItem[] allitems = searchResult.getResults(0, 3); if (allitems != null) { for (MediaItem item : allitems) { items.add(item); } } return items; } finally { if (sessionCreated && session != null) { session.close(); } } } public List<MediaItem> filterMediaItems(HttpServletRequest request, List<MediaItem> items, MediaItemFilter filter, MediaItemSortOptions sortOptions) { LOG.warning("filterMediaItems from ExampleFeedListener: do nothing, but here you could filter the returned items"); return null; } public MediaItemFilter overruleFilter(HttpServletRequest request, MediaItemFilter filter) { LOG.warning("overruleFilter from ExampleFeedListener: do nothing, but here you could overrule the filter"); return null; } public MediaItemSortOptions overruleSortOptions(HttpServletRequest request, MediaItemSortOptions sortOptions) { LOG.warning("overruleSortOptions from ExampleFeedListener: do nothing, but here you could overrule the sort options"); return null; } public List<String> getAllowedParameters(HttpServletRequest request) { LOG.warning("getAllowedParameters from ExampleFeedListener: do nothing, but here you could overrule the allowed parameters"); return null; } }