Adding references to the page head: the easy way

To add custom styles or functionality to a SharePoint page often requires including JavaScript or CSS files that need to be referenced within the <head> tag. Instead of adding these items to the masterpage and thus every page on the whole site it is better to just add them on only the pages that need them.

Many people use a hidden content editor webpart for this purpose but there is a second option. On each page layout there is a Content placeholder called “AdditionalPageHead”.

<asp:ContentPlaceHolder id="AdditionalPageHead" runat="server">

</asp:ContentPlaceHolder>

Anything placed inside this placehodler will be added to the head of the rendered page.

You can also create your own custom placeholders in the masterpage and page layout to allow you to add items to any part of the masterpage. For instance I have created a custom placeholder to insert webparts in the footer area of the masterpage.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top