1

I want to refer Custom CSS in my Page Layout

Page Layout

<link href="&#60;%$SPUrl:~sitecollection/Style Library/Test/Custom.css %&#62;" rel="stylesheet" type="text/css" ms-design-css-conversion="no"  runat="server"/>

Page-> View Source Below

<link href="/sites/UAT/_catalogs/masterpage/&lt;%$SPUrl:~sitecollection/Style Library/Test/Custom.css %>" rel="stylesheet" type="text/css"></link>

Actual CSS

/sites/UAT/Style%20Library/Test/Custom.css

1 Answer 1

2

Styles

If your page layout is an HTML file, try this:

<!--SPM:<SharePoint:CssRegistration name="&#60;% $SPUrl:~sitecollection/Style Library/Test/Custom.css %&#62;" runat="server" after="corev15.css"/>-->

If it'is an .aspx file, try this:

<SharePoint:CssRegistration name="&#60;% $SPUrl:~sitecollection/Style Library/Test/Custom.css %&#62;" runat="server" after="corev15.css"/>

Scripts

HTML masterpage:

<!--SPM:<SharePoint:ScriptLink language="javascript" Name="~SiteCollection/Style Library/Test/Custom.js" runat="server" Localizable="false"/>-->

aspx masterpage:

<SharePoint:ScriptLink language="javascript" Name="~SiteCollection/Style Library/Test/Custom.js" runat="server" Localizable="false"/>
2
  • Can you please suggest way for Custom js file also Commented Jan 5, 2017 at 15:28
  • I updated the answer Commented Jan 5, 2017 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.