Content Channel View Block

Now that you understand how to create content channels and items, the next step is adding them to your external website. The main block you will use to format channel content is the Content Channel View block. Adding this block to a page zone will allow you configure the settings listed below.

  1. Channel - The content channel you would like to display on the screen.
  2. Status - The content item status to filter on when creating a list of content items.
  3. Format - This is the Lava template selected to iterate through when displaying content items on the screen. See the Rock Lava documentation for tips and tricks on using Lava in Rock. If you're not using a template that ships with Rock (e.g., AdList.lava) you'll likely need to start with {% for item in Items %} to iterate through the content items.
  4. Items Per Page - The number of items to make available for the Lava template.
  5. Item Cache Duration - Rock can cache the items returned from the database to help improve performance.
  6. Output Cache Duration - Rock can cache the page output as well. This improves speed but is best used for non-personalized information. You don't want to display a wrong name because the page is displaying cached output!
  7. Cache Tags - Cache tags are used to link cached content so that it can be expired as a group. We have a whole chapter on creating and using cache tags below.
  8. Set Page Title - This will set the page's title based on the channel content. By default, it will display the channel name. If the query string contains an item id (in the format of Item=1) then that item's title will be used for the page title.
  9. Merge Content - When this setting is enabled, the block will look for Lava fields in your content and attributes. Then, it will compile and render the Lava. This allows you to put Lava logic in your actual content. Think of the power of having blog posts that can actually be dynamic to the user reading them!
  10. Detail Page - This setting allows you to define the detail page to add as a Lava merge field. This allows your Lava template to link to the detail page.
  11. Enable Tag List - You can add organizational tags to your content channel items as described above. Enabling this setting lets you control the display of content channel items by their tags in the Lava template (the Format field described above). Click the help tip ti ti-info-circle icon for this setting for details on the Lava. Enabling this setting also lets you use a query string parameter of ?Tag=tagname to filter the content channel items. These tags are used in addition to, and not in place of, any filters (see below) you have configured.
  12. Enable Archive Summary - This feature gives you an option to let people access old or expired content, without having to keep that content prominently displayed on your site. Using the additional 'ArchiveSummary' collection available in Lava, the items' Start Dates can be used to order and group this content by month and year.
  13. Filters - The content filter is very similar to the data view screens. This section allows you to filter by any attribute or property of the content item.
  14. Context Filter Attribute - This setting serves as a precision tool for your Content Channel View block. It allows you to designate a content channel item attribute that can have its value referenced against the page's context, ensuring that only relevant items are displayed. Simply select the attribute name from the list, ensure the content channel item has a value for that attribute, and observe as your content seamlessly aligns with the context of the page. Before using this feature, ensure you've defined the entity type in the block's properties to establish the context.
  15. Enable Query/Route Parameter Filtering - When this setting is enabled, the block will try to determine the content item to display based on a query string or route parameter value (other than the default ‘Item’ parameter). For instance, if you set this property and then include ?Title=Car Show in the URL, the block will look for an item that has a Title of ‘Car Show’. You can also add an item attribute for your channel ("slug", for instance) and include that attribute in the route to this page (series/{slug}, in this case). Additionally, you can add 'Month' and 'Year' parameters to filter content items by their Start date.
  16. Order Items By - Allows you to set the display order of the content items.
  17. Personalization Options - You'll use these settings to decide how personalization segments and request filters are applied to the page. For details and a description of the options see the Personalization chapter below.
  18. Meta Description Attribute - This setting allows you to pick an attribute to use for the meta description tag in the page header. This description is used when people share the page on social media.
  19. Meta Image Attribute - Allows you to set the page’s meta image tag in the header to the selected image attribute defined on the content channel.

But Wait... There’s More

The settings above provide a ton of capabilities when adding dynamic data to a page. This block can also respond to specific query string parameters to alter its behavior. Let’s look at each of them:

  • Item: If you pass in an item’s numeric id, the block will only load that specific item into the Lava merge fields. The query string parameter you add to the end of the URL would look something like ?Id=27.
  • Page: If you have more items than fit on a single page, you can navigate between pages using the ?Page=2. If you pass in a page number beyond the last page, the last page will be shown. If the page number is less than 1, the first page will be displayed.
  • Attributes: Content channel items can have attributes, and you can reference those attributes in the query string parameters. You'll use the attribute's ?Topic=Finances (or ?Topic=2 if the attribute is a single/multi-select field coded with numeric values).

Rock also supports passing in multiple values for Defined Value attributes that have 'Allow Multiple' enabled. In that case, the value you want in the query string parameter will be the GUID of the Defined Value you're looking for. Multiple values (i.e., multiple GUIDs) can be separated by a comma in the query string. This will return any items that have at least one of the provided values.

Showing a Single Item on a Page

Your Content Channel View block is great for showing all of the posts in a channel, but what about a block to show a single content item? You can use the Content Channel View block and use an ID or Title parameter, but we really want more SEO-friendly URLs. Enter the Content Channel Item View block, which brings you this and more.

This block gives you the option to "lock" it to a specific channel so that you can have a sermon series called "Moneywise" and a blog post titled "Moneywise" without having to worry about your pages getting confused about which item to show. To limit its search to a single channel, simply specify the Content Channel in the top input.

The Lava Template is the template which will be used to determine what shows up on the page. Initially, this will simply show the title of the item and the content below, but you can get really detailed in specifying how this page will be laid out. Using the Item object, you can access the properties and attributes of your content item for display on the page and even provide links to other pages.

In the Visitor Settings section, you can choose whether an interaction is logged every time someone views an item on a page with this block. You can also specify a Workflow Type that should be launched whenever this block is used to show an item. The workflow will be passed a Person entity which you can use to store the person who viewed the page (if they're logged in). If your workflow has a Content Channel Item attribute with a key of ContentChannelItem, that attribute will be automatically filled in as well. You can use that attribute to discover which item they viewed, and optionally perform different actions based on that information.

The Social Media Settings section will let you link any item attributes you added to the channel to special meta tags on the page. For instance, if your blog post has an image they've provided in an attribute, you might want that image to be shown on the preview that appears in Facebook when someone shares your post there. But you might want to ask your post author to provide a different image for Facebook than the image for Twitter, so you can use these fields to specify which attribute will be used for each social network.

Finally, in Advanced Settings, you can specify what this block calls a slug, if you use that parameter in the URL. For example, if you wanted to provide a URL with ?sermon=MoneyWise at the end instead of ?slug=MoneyWise, you could type "sermon" into this box, and it would look for an item with a slug matching the "sermon" parameter in the URL. (Of course, using parameters like this would break the SEO friendliness that this block was designed for, so it would be an unusual case that you would want to put anything in this field). Usually, you'll just want to access the page using an address like "/sermon/MoneyWise" which would match a Page Route of sermon/{slug}.

You can also specify whether the output and the item content itself is cached to speed up page loads. You can also allow the item being viewed to set the page title so that your users aren't seeing a generic title like "Our Sermons" when they load a page that is showing a sermon called "Our Cloud of Witnesses".

Tips and Tricks

Below are some tips and tricks to help you maximize your usage of dynamic data:

  • When you enable the ability to use Lava in content items, be sure that your Lava is set up to display data when the current user or other merge items are not available. When the content is made available via RSS, many of the merge fields will not be available.
  • The RSS feed for a channel can be linked to from the address: http://yourserver/GetChannelFeed.ashx?ChannelId=N where N is the channel id.