0

So, I have a standard bootstrap one page site. I am using django as the backend. for each section of the site, I use the html id I give to it to navigate to it from the navbar.

the only problem is that I cannot figure out how to clean the pound sign from the url. I still want something like:

example.com/contact

navigate to the contact section automatically, however, right it looks like:

example.com/#contact

How do I go about changing this? Is it something I need to add to the django urls.py file?

  • You can use this: https://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page – mrash May 12 '18 at 06:56
  • I don't understand how Django is involved in this questions; do you want to do a front-end URL hashchange? Or do you want to pass `#contact` to the backend? – rtindru May 12 '18 at 07:16
  • Browsers manage #contact of url and use it as page bookmarks [https://www.w3schools.com/html/html_links.asp]. you cannot send it to backend. – mrash May 12 '18 at 07:34

1 Answers1

0

How do I go about changing this? Is it something I need to add to the django urls.py file?

No.

# in URL is a Fragment identifier.

From https://blog.httpwatch.com/2011/03/01/6-things-you-should-know-about-fragment-urls/

... fragment identifier is only used by the browser – it doesn’t affect which resource is returned from the server.

As it's used by the browser you cannot do much about it unless you change your navigation implementation.

Dušan Maďar
  • 9,269
  • 5
  • 49
  • 64