When we’re designing or mocking up a SharePoint Intranet, Extranet or Internet we always talk about content roll up. SharePoint does a great job with content roll up OOTB (within the same Site Collection at least) using the Content Query Web Part. However, any time you show the client the power of the Content Query Web Part a typical question usually follows…
I love how I can see the top 5 most recent documents… but where is the link to “view more”? How do I get to the rest of the documents?
Like anything else with SharePoint it’s the 80-90% that’s easy and the little questions like this that cause the grief. Now, you could modify the Content Query Web Part styles but that’s not very manageable. Or you could drop a Content Editor Web Part on the page but that seems like a lot of work for one link. Heck, with SharePoint 2010 you could even use an inline Web Part in your main content area and just include the link yourself.
Isn’t there an easier way?
What if you wanted something that looks like this:
Let’s keep this simple, make it flexible and allow you to use this technique on any Web Part, OOTB or custom.
The Web Part Configuration
![]() |
First, we’re going to put the URL that we want the link to point to in the Title URL of the web part. Normally this would make the title of the Web Part clickable… but using some jQuery we can disable that link later.
Next we’re going to use the Description to hold the link caption (You we’re using the description anyways… were you?). Now when we save the web part SharePoint will automatically display the tooltip of the Web Part title as “Web Part Title – Web Part Description”. We’re going to use this detail to our advantage next. |
The jQuery
$('.ms-WPHeaderTd').each(function() { var title = $(this).attr('title'); var titleIndex = title.indexOf(' - '); if (titleIndex != -1) { $(this).attr('title', title.substring(0, titleIndex)); title = title.substring(titleIndex + 3); if ($(this).find('a').length) { var link = $(this).find('a'); var url = link.attr('href'); $(this).find('h3').html(link.html()); $(this).parent().append('<td class="view-more"><a href="' + url + '">' + title + '</a></td>'); } } });
The code above is going to perform the following:
- Loop through all Web Part Headers on the page
- Find the title of the Web Part
- Determine if the Web Part is using a description (we make some assumptions to do this)
- Remove the description from the Web Part title
- Make sure the Web Part has a Title URL configured
- Remove the link from the Web Part title
- Add a new table cell at the end of the Web Part title to show our view more link
The CSS
Last but not least let’s style our links! You can do anything you want at this point but here’s the CSS I’m using in the screenshot above:
.view-more { text-align: right; width: 70px; } .view-more a { color: #29466F; } .view-more a:hover { text-decoration: underline; }
jQuery to the rescue… again!

Cory Peters is the Chief SharePoint Architect at Eastridge Technology, a Microsoft Gold Partner in Winston-Salem, NC.




Hi Cory, thank you, just one question, my skills neing limited, I’d like to know, how and where do I include the Jquery?? ItemStyle? Masterpage? Can you just explain that step please? Thx
Hey Olivier,
I would recommend the Master Page or even a Content Editor Web Part if this is a one time one page solution. If using the Master Page option you can drop it in a <script type=”text/javascript”> tag or include the script in an external file. Either way you probably don’t want this code to execute until AFTER the page is loaded so you will want to use the jQuery ready event.
hlttp://api.jquery.com/ready
I copied the jquery code exactly as you have it and inserted it into a Content Editor Web Part for a one page solution, but its not working. My web part Title is IT Links, my Title URL refers to an aspx page (/Lists/Links/AllItems.aspx), and the Description is view more. Do I need to include this info somewhere within the jquery code?