Good Day,

I am having a little issue with creating static links in my Sharepoint Template. In the HTML for my navbar, I have attempted to link to the other pages that will be in the website, but the navigation does not work.

Adding links inside sharepoint work, and the href that is generated is the same formatted that I have used in my HTML.

<ul class="nav navbar-nav navbar-right" style="margin-top: 40px; ">
          <li class="active"><a href="/Pages/default.aspx">HOME</a></li>
          <li><a href="/Pages/about-us.aspx">ABOUT US</a></li>
          <li><a href="#">KEY FEATURES</a></li>
          <li><a href="#">SERVICES</a></li>
          <li><a href="#">DOCUMENTATION</a></li>

The markup generated by the Sharepoint link is:

<a href="/Pages/about-us.aspx">About-Us.aspx</a>

I checked and case sensitivity is not an issue. Am I missing something? Or is there a more effective way to do this linking?

I saw an error about an uncaught error in my inspect element saying: 'Uncaught Error: Syntax error, unrecognized expression: /Pages/about-us.aspx'.

It references the jQuery.min.js as the source of said exception and below is the code for the section of the min.js file throwing the error.

function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)}
  • Do you only want it to be in a list? The html looks good. Have you looked at jquery: jqueryui.com/menu – David Jenkins Aug 18 '16 at 20:31
  • I just now took note of this error: jquery.min.js:4 Uncaught Error: Syntax error, unrecognized expression: /Pages/about-us.aspx – trevoirwilliams Aug 18 '16 at 21:15
  • What does the function look like? – David Jenkins Aug 18 '16 at 22:26
  • I updated the question with the function throwing the error – trevoirwilliams Aug 22 '16 at 13:52

I don't have enough reputation to comment yet, so I'm putting this as an answer instead.

Need more information to help you. How is the navigation not working? Do you get a 404 page not found error? What url is it linking to? Is the generated url that does not work EXACTLY the same as the manually created url that does work?

Take a look at the generated HTML in your browser's dev tools inspector and verify what the nav links are actually pointing to.

| improve this answer | |
  • thank you for your questions. They are acting like dead links. The block of code above, then clicked, it is as if the href is blank. I used inspect element to compared my code as opposed to the sharepoint generated code and they are identical. Yet the Sharepoint on works. – trevoirwilliams Aug 18 '16 at 17:03
  • I would guess that there is a javascript onclick handler that isn't wired up properly. If all you need are static links, make sure there is no onclick event that could be messing with it. If my guess is wrong, try providing the actual markup from that part of the page (with the url path changed for posting security) and I'll take a look and see if I can spot anything wrong. – NiceNix Aug 18 '16 at 17:16
  • Will update the original post – trevoirwilliams Aug 18 '16 at 17:24
  • updates have been made – trevoirwilliams Aug 18 '16 at 19:00
  • Obviously, the three links with just href="#" won't work, but I'm guessing you already know that. I don't see anything in your code yet that wouldn't work. The browser doesn't know if the link came from a template or was added in a content editor webpart ... it just interprets the html it is passed. If the html for two links on the same page are actually identical, then the same thing would happen when you click them. You must be overlooking something that you haven't included in the code of your question. Do you have any more information that you think might be affecting things? – NiceNix Aug 18 '16 at 19:13

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.