I create the project "SharePoint 2013 - empty Project", add SharePoint Layouts Mapped Folder, then add to script file, path /_Layouts/SearchWords/jquery.min.jsand publish project. I see my folder in C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS but not see in http://sp/_Layouts/ after publish project. "SharePoint Server Publishing" is activate to all sites and subsite. What is the problem, how is the fixed?


Try using absolute path to the file like given below:

<script type="text/javascript" src="https://test.sharepoint.com/sites/siteName/_layouts/15/SearchWords/jquery.min.js"></script>

Or for short path, try using below:

<script type="text/javascript" src="/sites/siteName/_layouts/15/SearchWords/jquery.min.js"></script>
  • Yes, i understand to my need "_layouts/15" – Fox Feb 26 '19 at 9:48

You can use JSLink with ~sitecollection token to get current site collection dynamically

<SharePoint:ScriptLink ID="jqueryScript" language="javascript" name="~sitecollection/_layouts/15/SearchWords/jquery.min.js" OnDemand="true" runat="server"/>

Or ~layouts token to get URL of the Layouts virtual folder for the current website

<SharePoint:ScriptLink ID="ScriptLink1" language="javascript" name="~layouts/SearchWords/jquery.min.js" OnDemand="true" runat="server"/>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.