Best Practices
General > Best Practices > Modifying news/articles View modes: 
User avatar
Jack Fear - 2/12/2008 7:15:02 AM
Modifying news/articles

I need some "extra" feature for news or articles displayed on the page.
I would like to display on home page all the articles published during a period of time and only some of them under the news page.
The ones on the news page should be the ones that only contain the news articles. The ones on home page should be all announcements about the news articles, new competitions announcements or interviews that have their own page.
So, on home page I will have more items than on the other pages and need to link the news header text to that particular item under the related pages.

Example: News article on the home page will have header text "My first news article" and some summary text. It points to news/first_news.aspx.
New competition advice on the home page will have header text "New competition on this site" and some summary text. This points to competitions/first_competition.aspx.

If there are any triggers in the article or news documents and the abillity to set the path I can solve this. The question is if I need the source code license to make the apropriate modifications or is there any other built-in solution?

Thanks for the answer.

User avatar
kentico_vitaja - 3/21/2008 10:00:18 AM
RE:Modifying news/articles
Hi Jack,

I think that you can easily achieve this even without source code license.

1. Create your document types (news, article, announcements) and make sure that they have same field name "header". Create appropriate transformations for your document types.

2. Create folders for your documents. Folder structure can be like this one:
-> /documents
-> -> /news
-> -> /articles
-> -> /announcements

3. Place your documents to appropriate folders.

4. Add repeater web part to your homepage. Make sure that you correctly specify all necessary fields like:
Path: /documents/%
Document types: CMS.Article;CMS.News;CMS.Announcements

5. Repeater web part transformation should be similar to this one:
<h2><a href="<%# GetDocumentUrl() %>"><%# Eval("header") %></a></h2>

6. Create other pages (News page, Articles, Announcements) and add there repeater web part with Path and Document types properties selected to appropriate document type.

That is all - your site should be working as you described.

Best regards,
Vita Janecek