3

I have been creating different views on a list and have noticed that the page title is always the list name regardless of the view that was selected. Is it possible to change the title of Page to that of the view that was selected?

  • I'm sure this can be done with jQuery. The syntax is going to vary depending on the version and edition of SharePoint you are using. – Rob Wilson Aug 17 '10 at 0:21
3

No need to use a framework, nor SharePoint Designer. If you have permission to add a Script Editor web part to your page, you can fix this with a single line of JavaScript:

<script type="text/javascript">
    // Replace default page title with document.title, which is based on view name
    document.getElementById("DeltaPlaceHolderPageTitleInTitleArea").innerHTML = document.title;  
</script> 

I've been using it to customize asset library views so the name of the view is included in the title on the page.

  • What about on the default view "page". Do I have to create a web part page and insert the view into this page first before I can do this? – Aubrey Robertson Jan 5 '18 at 22:53
  • 1
    I was able to use this code with SharePoint Online (O365), but I didn't have my view in a web part page. I added the code in script tags using SharePoint Designer 2013. I added the code right before the closing asp:content tag for "PlaceHolderMain". – Aubrey Robertson Jan 6 '18 at 0:28
2

You can do this by modifying the .ASPX page for the view using SharePoint Designer. Just change the contents inside the tags shown below:

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
    Whatever you want to be displayed in the Browser titlebar
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
    Whatever you want as the title shown on the page
</asp:Content>
  • I take it we're talking about 2007, because in SharePoint 2010 the name of the view is actually reflected in the page title be default. Good answer. – Rob Wilson Aug 17 '10 at 5:05
1

Here is a user-facing solution for Sharepoint 2013.

Create a text file called PageTitleAsHeader.js, containing the following code:

<script src="/_layouts/jquery/jquery-1.10.2.min.js""></script>
<script>
$("#ctl00_PlaceHolderPageTitleInTitleArea_SPTitleBreadcrumb1 > span > a").html(document.title);
</script> 
  1. Copy the file into your SiteAssets library and copy its URL.
  2. Go to your view and Edit Page.
  3. Insert Web Part - Media & Content - Content Editor.
  4. Edit Web Part.
  5. Paste in the URL from step 2 into Content Link.

This will change the onscreen page title (next to the logo) into the same title you see in the browser tab: the list name followed by the view name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy