Skip to main content

News aggregator web part

This topic describes a way to configure SharePoint elements for displaying headlines and abstracts from news articles, aggregated across many sites.  Also a description of customizing the page layout of the news article is given.

Displaying the news headlines:


When clicking on the headline in the web part, the user is taken to see a typical news article:

Elements of this Approach

  1. Custom Content Type to provide aggregation target.
  2. Custom Page Layouts to provide controls for aggregation plus custom look and feel.
  3. Custom Web Part (Content By Query) to display desired news in desired format/behavior.

Prerequisites

Site where news pages are created must have Publishing feature activated.
Site Settings à Site features à Office SharePoint Server Publishing [Activate]

1. Custom Content Type

Create a new Site Content type on the top-level site (corporate intranet site)
Call it Adatum News Article, make its parent type an Article Page (from the Page Layout Content Types), and put it in the Adatum Content group.  If this is the first member of the group, then you will have to make a New group with this name as shown in this sample:

 

2. Custom Page Layouts

Using SharePoint Designer, open the top-level site, and open the MasterPageGallery (in the _catalogs folder).  Copy several layout files and rename the copies such as in the following sample:

Existing layout file
Copied layout file
ArticleLeft.aspx
AdatumArticleLeft.aspx
ArticleLinks.aspx
AdatumArticleLinks.aspx
ArticleRight.aspx
AdatumArticleRight.aspx

Associate with Custom Content Type

After copying the custom layouts, associate the custom content type with each one.  Using the SharePoint Site Settings, click Master Page and Page Layout Galleries, and you should see the new custom layouts that you added.  Edit the properties of each one to set the associated content type; select the custom type that you created, such as shown in the following sample:


The Title property is the string that will appear on the page layout when a user edits the page to create or modify news.

The Description property is the string that appears when people are choosing the format for their news article.

The Preview Image property allows you to specify an image that is shown when people are choosing the format for their news article.  End users really like thumbnails, so it will help to finish customizing the custom layout page and then create a sample article that you can take a screen shot of and turn into a thumbnail.  This preview image is rather large (220x140) and can be a jpg or gif, so you can get some detail to show.

The Associated Content Type property should be set to the custom content type that you created.  This will allow the news aggregator to find this article quickly.

Customize the Page Layout

At this point, you don’t have to do any further customization in order for the news aggregation scenario to work.  But

Add a Description Control

The Content By Query web part that we’ll use for our news aggregator has several different viewing formats available.  Several of these show the Description property of the news article page.  Unfortunately, there is not a control to enter the description on the page layout; to modify this out-of-box you have to edit the properties from the page library view.  But we can easily add a control to the page layout to provide an input field for the description property, and this makes it much more useful for people writing news articles to show an abstract for the article.

Check out and edit each of the copied layout files to add two items: a NoteField control for the Description field, and an EditModePanel to show instructions for the Description field.  Put these controls into a new row in the table containing the date and byline, as shown below.


The following sample shows a new page that has been created with the customized page layout.  You can see the additional Description field


At this point, you are ready to create new pages with this layout.

Create a new page with this layout

This step is an example, it is not necessary to create the masters.  Go to a site in the hierarchy of the portal that has the Publishing feature activated.  By default, the Corporate Intranet Site and the Team Publishing Site have this feature, but it is easy to activate for other sites as well.

Under Site Actions, click Create Page, and select the new custom layout, as shown below.


3. Custom Web Part – the Aggregator

Add a Content Query web part to the page, and set it to Show items from all sites in this site collection.  Then set the List Type to Pages Library, and the Content type to Adatum News Article in the Adatum Content type group, as shown below.


Other configurations include Filtering, Sorting and Styles under the Presentation header.  Choose what is suitable; the examples here sort by Article Date descending, set the Group style to “small text”  and the Item style to “Image on right” which tends to look better when there is no rollup image for the article.  A generic Adatum news logo was created for people to use when they don’t have a rollup image, or they could leave that blank.

Once the look and feel is acceptable, export the web part so you can use it in other places.

Further Customizing the Look and Feel

XSLT can be used to make additional customizations to the views available to the Content Query web part.  This can be used for several other techniques:
  • Show the first X characters of the news item as the abstract instead of using the Description field
  • Open news items in a new window.
  • Show other metadata from the news item.
I was all set to show a simple example that you could extend, but then found Steven Van de Craen's  excellent, detailed instructions for doing this.  See his blog entry at SharePoint 2007 Beta 2: Customizing the Content Query Web Part XSL.

Behavior

Another challenge for most approaches is allowing the user to read the news without taking their browser to the site where the news is published, since some people claim this causes confusion.  Further, it will be desirable to have a link to allow the person to visit the site where the news is published if that’s what they want.  Both of these can be accomplished using the XSLT techniques referenced above.

Comments

Popular posts from this blog

Sharepoint 2010 Subsites webpart

This posting was originally made by Arild Aarnes and it is in here . This is a simple webpart to show a list (with links) of subsites immediately below the current site. This webpart will work on both Sharepoint 2010 and Sharepoint Foundation. On Sharepoint 2010 you could have used the built in “Table of Contents” webpart to do similar things but this one can also display the list as a dropdown list to save space on the webpage and it can open links in a new window. All the settings can by edited in the webpart configuration panel. The settings are: Show bullet in list – this will display the small square gif in front of the site name Open link in new window – this will open the subsite in a new window Show Site Description – this will show the description you entered when you created the subsite Show icon – Shows a icon for the type of subsite, see picture. Show as dropdown list – Will display the subsites in a dropdown box to save space. The webpart can be downl

Configuring the User Profile Service in SharePoint 2010

I will share with you my step by step guide in setting up the User Profile Service application, focusing on its configuration and administration and how we can enable the creation of user profiles via an Active Directory import . SharePoint 2010 introduces the notion of “Service Applications” which build’s upon the “Shared Services Provider (SSP)” which was introduced in SharePoint 2007.  Service Applications are individual services that can be configured independently and can be shared across other sites within your farm with some service applications that can also be configured across farms. The individual service applications provided with SharePoint 2010 are listed as follows; Access Services Business Data Connectivity Document Conversion Excel Services Managed Metadata Service PerformancePoint Search Service Secure Store State Service Visio Graphics Service User Profile Service This article will build upon our initial SharePoint 2010 install utilizing the least privi

The Text Filter Web Part – Without Having To Filter Exact Text

This posting I took it from  Here   This applies to both SharePoint 2007 and 2010.  In MOSS Enterprise, and the 2010 version of Enterprise.  There is an out-of-box web part called the Text Filter Web Part .  Basically, when you put this web part on a page, and put a list or library web part on the same page, you then create a web part connection that sends the text typed in the box as a filter to one of the columns in the web part, like this: The name Molly Clark had to be typed in exactly.  So, if you typed “Molly”, this record would not come up.  People use the text filter web part when they just want to search a single column in a list or library.  Otherwise, you’d simply use the “Search” box at the top of the screen, choose “This List” or “This Site” and perform SharePoint searches that way. One more note before I get into today’s solution: If you’re making use of site columns in your lists, there’s a setting where you can specifically select which columns you do N

Telephone format for a text box on infopath form

If you want to create a Telephone format on a infopath form : 1. Add a text field to the form (Even if it is the list or a blank form) 2. Select the text box and click on Manage Rules 4. Add a rule to your textbox control with the following conditions (make sure to select "and" operator):     a. field "does not match pattern" Phone number     b. the expression: string-length(translate(., "()- ", "")) = 10     c. the expression: string-length(translate(., "()- 0123456789", "")) = 0 5. Add action to the rule:     a. Set a field's value     b. Select your textbox field     c. Insert formula for the value (click the fx button): concat("(", substring(translate(., "()- ", ""), 1, 3), ") ", substring(translate(., "()- ", ""), 4, 3), "-", substring(translate(., "()- ", ""), 7, 4)) Link for the detailed explanation :  http:

HOWTO: change the home button text on the top link bar in sharepoint 2010

Hi All, I got a requirement that the title of the site collection which shows the first button on the top link bar to be different from the title. for example: my sharepoint site title is " Srikanth SharePoint Blog" and I need to show"Home" on the top link bar. It shows Home when the publishing features are not enabled. But once the publishing features are enabled it shows the same as the title("srikanth sharepoint blog" in my case instead of "Home").In other blogs I saw the solution as "in SITE ACTIONS>SITE SETTINGS>LOOK AND FEEL> TOP LINK BAR" , but once the publishing features are enabled, you don't see the "TOP LINK BAR" under "LOOK AND FEEL"(ofcourse it is changed to "NAVIGATION" , when publishing features are enabled). In this case : 1. Hide the initial button by adding code in css.    .s4-tn li.static > a{ display: none !important; } .s4-tn li.static > ul a{ display: bloc

SharePoint Branding and Design in 2010-2

Update: Really Small SharePoint Calendar I really was not that happy with the look of the first calendar so after some modifications and a bit of CSS magic I have come up with a really good looking small calendar. At least I think so… Basically I have replaced the text of an event item with a color coded box. The benefit that you get out of this is that you don’t have to try and read the even within the small calendar but if you hover over and click on the color block you get the list Item display. Orange is for single event items (8am-10am, etc) Green is for full day events or repeat events Another nice feature to this is that I have also simplified the visual indicator when there are more then two event items in one day. Instead of seeing the arrow and text all you see is the arrow. Once you click on the arrow it will show the other blocks of events (Right image). Here is the CSS Code: Download Here Simply place a content editor web part on the same page as the calendar

SharePoint Branding and Design in 2010

Hide First Tab in SharePoint 2010 Navigation I created a blog post on this for SharePoint 2007 HERE : But SharePoint 2010 is a bit more complex. Since it uses UL’s and Li’s for it’s navigation it is a bit harder to hide just one element. You will notice that the Home tab actually is the first node and then has a child UL which represents the rest of the navigation Items. So the approach is to hide the first <li> <a> (display: none) and then simply just use (display:block ) to show the hidden <ul> <li> <a> tags. Here is the CSS you could use to hide just the first node (home) tab in a SharePoint 2010 application: .s4-tn li.static > a{ display: none !important; } .s4-tn li.static > ul a{ display: block !important; } Enjoy! Posted by Erik Swenson at 12:12 PM 2 comments Labels: Branding , CSS , SharePoint 2010 Wednesday, August 18, 2010 How To: Hide Left Side Navigation on Home Page I was recently asked: " How can I hide the sid

Data View conditional formatting using SharePoint Designer

Data View conditional formatting using SharePoint Designer This article demonstrates how to use SharePoint Designer 2010conditional formatting to format items in a SharePoint (SPS 2010) list based on item metadata. The example uses a standard SharePoint task list and formats tasks based on the due date. The end result is a list view sorted by due date with item text or background coloured to represent the number of days until the due date. The Process In this example I have started with a standard task list and have created a few sample items for testing / demonstration. From the task list, create a new view, starting from the default “Active Items” view (filtered to only display incomplete tasks). The view created in the example is called “Active – Coloured” Open the view using SharePoint Designer. Right click on the List View Web Part and select “Convert to XSL Data View”. This will automatically convert settings for the current view into da