This is usually set up using a SharePoint list that contains the announcements or news items, and a content query web part on the front page gets the most recently published news item or article. This is a quick way to update the home page without having to edit the html source on that page every time the news or announcement changes.
However, the issue with this approach is that it only shows one announcement at a time. Sometimes, there may be multiple news items or announcements to show on the home page, but you don't have the space on the page for multiple items.
I was tasked with taking an existing news content query web part and replacing it with a Content Slider. This would show each news item on the page for a few seconds, and then scroll to the right for the next news item. A group of buttons at the bottom allows direct control of which news item you wish to see.
Awkward Showcase on GitHub
Step 1: Download supporting libraries.Within the SharePoint site that is going to be hosting your content slider, locate your site assets library. If it doesn't exist, create a document library called site assets.
Download and unzip the AWShowcase files locally, and place the unzipped files and folders in your site assets library. Download the jquery source file and SP Services jquery source files and place those in your site assets library as well. Your site assets library should look similar to this:
Step 2: Update your news or announcements library.If you have an existing news or announcements list, you will need to add and update a couple of fields to make it work with this content slider. The first thing to add is a field called "Slider". This is a straight text field. If you want your announcement or news article to appear in the slider, you put the letter "Y" in this textbox.
You may already have a start date associated with your announcement/news list. If not, add it now. If you name it "StartDate" as one word, then you won't need to change the jquery for that field later.
You will also have a field that contains the announcement content. In my case, I called the field "HTML" because it allows rich html content to give richer tools to people entering the slider content. You will need to change the field name in the code below if it is not "HTML".
If you have not already enabled it, enable approval for the announcments/news list. The list items must be approved to show on the content slider.
Step 3: Add and populate the content editor web part.Navigate to the page you wish to display the new content slider on and edit the web part page. Add a new content editor web part. Edit this web part and choose to edit the HTML source.
Add links to your supporting libraries at the top of your html content:
Now, copy and paste the following code underneath your supporting library links:
Step 4 - Modify the code to suit your environment.Make the following changes in the code:
- Update all of the view fields in the CAML query to match your field names. So if the field I call "HTML" is called "Announcement" in your source list, change all instances of HTML to "Announcement". Make sure you change the names in all locations, use search and replace.
- Update the name of the announcements list to match the name of your source list. In the code above, our list is called "spotlight".
- Refer to the github link at the beginning of this article to understand the showcase property customizations. You will want to modify the width and height to fit your page.
The other potential source of issues is within the field names. Be sure your field names are the internal SharePoint names for those items, rather than the name displayed on the list. If you are unsure what the internal name is, open properties for that list, and hover over the column names. The link that appears will contain the actual field name at the end.
The field looks like "Start Date" but when we hover over the field we see this URL
we know the actual field name is "StartDate".