The Hidden Anchor Tag in SharePoint Online
This little gem came as a surprise to me and I am pleased to share this one out. I learn every day and when I discover that we could finally do some anchor tag in the SharePoint Online experience I couldn’t understand why this is not publicized a bit more as this comes as a common request.
What are anchor tags?
Really quickly so that we are all on the same page. Anchor tags are basically a way to navigate to a specific section of a page using a parameter in the URL. This might look more familiar: https://randomsite.com#header1
What was the issue?
Well, it did not felt like there was a nice and elegant way to achieve this in SharePoint Online modern experience. Again, this was based on the fact that I was not even aware that the option existed and we’ll review this now.
How to do it?
Anchor tags are available when you use the Heading 1 on the Text web part.
Go ahead and add the text web part on any modern page, then select the Heading 1 from the first dropdown
You can add a few of them and some normal text in between so that you can see the anchor in action. You should end up with something along those lines.
Cool, so now publish the page.
Now if you over the Heading 1, you should see an icon appear. Click on it and notice the change on the URL. You should see something like:
https://something.sharepoint.com#some-heading
That’s it. You can now use it for navigational purposes. Pretty cool huh?
Read more: Don’t do custom SharePoint development