How to always display section ID in the URL Bar

Hi, I would like to know what is the best way to show #section id in the url of the website at all times so for example if the website url is google.com and the section is called youtube i want url to be google.com#youtube so that if user wants to copy url and share it it will link directly to that section.


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

@CerkaB - definitely a custom code thing, you can always put an anchor link icon in the page that can be clicked on to copy the current section url, a lot of sites that are doing documentation have this functionality, for instance GitHub documentation:

However, this does require the user to click the section header or sometimes people use a link icon :link: that will copy it to the clipboard.

As far as doing this as the user scrolls, this is not common functionality, you might be able to do it using something like this, but I haven’t tested it and based on the importance / implementation I’m not sure I’d recommend it.

Take a look at this answer there:

That answer seems to suggest a solution to your problem, but it has no upvotes and no one has commented on it, so it may / may not work.

1 Like

Thank you sam for your reply. I have tried using the code provided in another post but it does not seem to work. I think solution you suggested is great and I will try to implement that.