Example - Publishing community news

In this example, you will create a new section for publishing community news. Each registered site member can create new news items and edit/delete their previously posted news. The example assumes that you are using the sample Corporate Site.

Creating the community news section

  1. Open the Pages application and Create a blank page under the Examples page.
  2. Name the page Community news.
  3. Switch to the Design tab of the Community news page and add the Repeater web part.
  4. Set the following properties for the Repeater web part.
    • Web part control ID: repeaterNews
    • Page types: CMS.News
    • Transformation: CMS.News.Preview
    • Selected item transformation: CMS.News.Default

Community news section with a repeater

                                                         

On this page

Adding the New page button

Add the Contribution list web part to the Community news page and set the following properties for the web part:

  • Show for page types: CMS.MenuItem
    • Ensures that the web part is displayed only when the list of news is displayed, not on the news detail page.
  • Allowed new page types: CMS.News
    • Ensures that the users can create only news items under this section.
  • Display list of pages: clear the check box
    • Ensures that the web part displays only the New page link, without displaying the list of pages.
  • Allow editing by users: Authenticated
    • Ensures that only authenticated users can edit/delete the page.

The web part displays the New page link. Try to create a new page using the link on the live site.

New page button added to a page

Adding the editing support

Add the Edit contribution web part to the Community news page and set the following properties for the web part:

  • Show for page types: CMS.News
    • Ensures that the web part is displayed only on the news details page.
  • Allow editing by users: Page owner
    • Ensures that only the creator of the news item can edit or delete the page.

The web part displays the Edit and Delete buttons when the author opens a news item they wrote.

Edit page button added to a page

Testing the results

  1. Open the Users application and click New user.
  2. Set the following properties:
    • User name: Test
    • Full name: Test user
    • Privilege level: None
  3. Save the user.
  4. Switch to the Sites tab and assign the user to the sample Corporate Site.
  5. Sign out and sign in to the Corporate Site as Test.

On the Community news page, Test user can see and use the New page link. Once you save a new page, the Delete button appears. If you go back to the Community news page and click the newly created news item, you can edit or delete the news item.

Approval process

To set up an approval process for published news, use workflow on the particular site section.