Set up the feeds

A feed (or news feed) is a data format used for providing users with frequently-updated content, such as news for a site, or posts for a blog. A feed can be provided in different formats, such as RSS or ATOM, and can be subscribed by a user with a feed reader application.

Adding feeds to a site is very important because it provides users with the latest content without them having to visit the site.

By default, eZ Publish doesn't provide a self-generated feed. However, it does provide an option for the site administrator to enable one from the administration interface.

Moreover, any node of the content tree can be used to generate a feed, through a very flexible system that can handle any kind of content class.

We will add a feed to the forums and the blog, choosing the best class attributes for both.

Creating the blog feed

Log in to the backend. From the Setup tab, we will click on the RSS link in the left-hand sidebar.

Creating the blog feed

Next, click on the New Export button and complete the form with the necessary data for our new feed, which is a Name, a Description, and a Site URL.

In this form, eZ Publish will require some information regarding the feed itself, as we can see in the following screenshots:

Creating the blog feed

The feed information includes the following:

  • Name: The name of the feed that we will publish.
  • Description: The text used to describe the feed.
  • Site URL: This is used to produce URLs in the export, comprised of the Site URL (http://www.packtmediamagazine.com/index.php) and the path to the object (/articles/my_article). Leave this field empty if you want the system to automatically detect the URL of your site from the URL that you access the feed with.
  • Image: This image will be attached to the feed, as a favicon.
  • RSS version: This is the version of the RSS format that is used by eZ Publish in order to publish the feed.
  • Number of objects: This value represents the number of objects that we want to add to the feed.
  • Active: This checkbox will be used to enable or disable the feed.
  • Main node only: If checked, only the main node will be selected otherwise the children node will be added to the feed.
  • Access URL: This represents the feed URL. By default, eZ Publish uses the reserved prefix path /rss/feed/. We have to create a valid Access URL as blog.

After we define the feed's information, we have to configure the sources from where we want to retrieve the objects to be taken for the feed. We can do this by completing the Source 1 subform as shown:

Creating the blog feed

To configure the feed source, we have to define:

  • Source path: This is the path of the navigation tree of the site from which we want to gather the data.
  • Subnodes: If enabled, the subnodes of the main node will also be used.
  • Class: We can filter the object class that we want to add to the feed. In our case, we will choose the Blog post class.
  • Title: We can choose which attribute of the Blog post class we want to use as the title of the single feed.
  • Description: In this field, we can choose which attribute will be used as a description for the feed. In our case, it will be the Body attribute of the Blog Post class.
  • Remove/Add Source buttons: These buttons will add or remove the settings that we have configured.

When we configure the Source path, by clicking on the Browse button, eZ Publish will ask us to choose the node that we want to use to create the feed.

Creating the blog feed

As shown in the previous screenshot, we will select the blog node as the primary source. This will ask the system to check for content only in that node, and to not use the whole site.

Next, we will choose which classes we want to include in the feed, and which class attributes should be used for the feed title and content.

For the blog, we will use the Blog post class. After we click on the Set button to refresh the class attributes, we will select the Title and Body attributes for the feed Title and Description respectively.

Next, click on the OK button to save your settings and check for the feed.

You can see if the feed is enabled by taking a look at the navigation toolbar in any modern browser. For example, in any 3.x version of Firefox, the feed icon will appear on the left-hand side of the domain name. This is seen in the following screenshot:

Creating the blog feed

Creating the forum feed

We have an additional requirement for the forum. We want to include all of the new discussions in a single feed, which will create a kind of aggregate feed.

As before, click on the New export button from the RSS setup page, and complete the form by specifying the required feed information, such as the feed Name, Description, and Site URL as shown in the following screenshot:

Creating the forum feed

The main difference between this and the previous example is in the Source 1 subform, where we will select the /Homepage/Forum as the Source path, and select the Subnodes checkbox. This is shown in the following screenshot:

Creating the forum feed

This setting will cause a full parse of the selected node to be made, in order to check if any subnodes with the specified content class exist, and will then add any such subnodes to the feed.

Note

Multi-source feed

eZ Publish allows us to create a multi-source feed. For example, if we create some blogs on different document tree nodes, we can include all of them in our feed by using the Add source button in the RSS edit page. In fact, clicking on that button will create a new sub-section called (in our case) Source 2, where we can configure a new Source Path that will be merged with the one that we configured before.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.108.119