News widget

You use the News widget to display news items on your website pages. You select what content to display and then specify how news items are listed and displayed individually.

PREREQUISITES: You created at least one news item. For more information, see Create news items.

Choose what content to display

  1. In the upper-right corner of the News widget, click Edit.
  2. In the Content tab page, choose which news items you want to display. Choose between the following options:
    • All published news
      All created news are displayed.
    • Selected news...
      A custom selection of news items is displayed. To select one or more news items you want to display, click the Select button.
    • Filtered news by... 
      Narrow down news items displayed by using:
      • Categories…
        Select categories from which to display news.
      • Tags…
        Select the tags by which to narrow down news that are displayed.
      • Dates…
        Select one of the predefined time intervals or choose Custom range… to select a more specific time interval, in which the displayed news must be created.

        NOTE: You can select more than one filter and narrow down results using combinations of filters, for example by both categories and dates.

  3. When finished, click Done selecting.

List settings

List settings define how news items are listed by the News widget. Choose one of the following options:

  • Use paging
    Divides the news into pages. In the input field, specify how many news items per page to display.

  • Use limit
    Displays only a limited number of news items. In the input field, specify how many news items to display.

  • No limit and paging
    Sitefinity CMS displays all news that meet the requirements and filters you set in the Content tab.

  • Sort news
    By default, last published news items are listed on top. You can select a different sorting criterion:

    • Last published
    • Last modified
    • By Title (A-Z)
    • By Title (Z-A)
    • As set manually
      This option is available only when you selected specific news items in the Content tab using Selected news…. If you select As set manually, news items are displayed in the same order as in the Content tab.
    • As set in Advanced mode
      To sort the list of news items by property that is not defined in the sort dropdown menu, you must add a new sorting expression in the designer’s Advanced mode. For example, to sort news using the Content property of news, navigate to Advanced » Model and, for SortExpression, add Content ASC. As a result, in the sort dropdown menu, the As set in Advanced mode option is selected by default.
  • List template
    Select the template you want to use to list news items on the webpage.

  • CSS classes
    Expand More options section to specify CSS file names and apply additional CSS classes to the News widget.

Single item settings

Single item settings define how individual news items are displayed. Choose one of the following options:

  • Open single item in...
    Select one of the following:

    • Auto-generated page
      When you click a news item, it is displayed in an automatically generated page with the same layout as the list page.

    • Selected existing page…
      From the list of existing pages, select the specific page in which news items are displayed.

      NOTE: To display a news item in a page, the page must have a News widget added in advance.

  • Detail template
    Select the template you want to use to display news items on the webpage.

  • CSS classes
    Expand More options section to specify CSS file names and apply additional CSS classes to the News widget.

Advanced settings

In Advanced settings, you specify individual properties of the widget:

  • DetailsPageId
    Gets the ID of the page you selected in the Selected exsting page.. option in the Single item settings tab page.

  • DetailTemplateName
    Gets the template you selected in the Detail template dropdown menu in the Single item settings tab page.

  • DisableCanonicalUrlMetaTag
    Sets a rel="canonical" metatag to news items. For more information, see Locations of content items: Canonical URLs.

  • ListTemplateName
    Gets the template you chose in the List template dropdown menu in the List settings tab page.

  • OpenInSamePage
    Defines whether when you click on a news item title to open the detail view in a new window The default value is False.

Model settings

Model settings display all properties directly bound to the News widget model. Access these properties by clicking the Model button in Advanced settings.

  • ContentViewDisplayMode
    By default, a single content item is displayed in Detail view. This property enables you to configure whether single content items are displayed in Detail or in List view by entering Detail or List, respectively.

  • DetailCssClass
    Gets and sets an additional CSS class to the detail view of a news item.

  • DisplayMode
    Gets the value you selected in the Simple List settings tab page:

    • Paging
      This is the default option.
    • Limit
    • All
  • FilterExpression
    Filters news items based on an additional filter expression.

  • ItemsPerPage
    Defines the number of news items per page when paging is enabled. The default value is 20.

  • ListCssClass
    Gets and sets an additional CSS class to the list view.

  • ProviderName
    If you have more than one providers added, you can use a news providers different than the default one. To do this, specify the name of this provider.

    NOTE: If you leave this property value empty, the default news provider is used.

  • SelectionMode
    Gets the option that you chose in the Content tab page. The possible values you can chose from are:

    • AllItems
    • SelectedItems
    • FilteredItems
  • SerializedAdditionalFilters
    In case news items are filtered based on a date, tags, or categories, the IDs of the selected filter criterions are serialized and populated in that field.

  • SerializedSelectedItemsIds
    In case news items are items you specifically selected, the IDs of the selected news items are serialized and populated in that field. For example: ["3f47d0b8-2d22-6e58-888c-ff0000bfc4e0"]

  • SortExpression
    Adds additional sorting expression for the news items. The default value is PublicationDate DESC.

  • UrlKeyPrefix
    Gets or sets the URL key prefix. Used when building or evaluating URLs for paging and filtering.

Tags

Was this article helpful?