Modern pages are a much simpler way to create pages in SharePoint. However, there’s a limitation at the moment that is being discussed over many forums that relates to the fact that anchor references and bookmarks cannot be added to headings within a modern page. Here is one such discussion with a couple of statements below it.
Finding it very hard to push the adoption of Modern pages with so little control available. Even the ability to add anchors on a long page has stopped users in their tracks!
Agree with previous comments. Modern pages are very hard to work with. One expects that features of Classic would be available in a modern page (e.g. via Communication Site). In particular, the lack of anchor points is very frustrating for end users who have to scroll through a long page
Seeing is believing
You can give this a go yourself.
- Create your table of contents in Word or create your references
Load the Live Publish panel, via Word | Insert | Add-ins | My Add-ins | See All | Store and search for “Live Publish”
Select Live Publish and select Add and confirm.
Register and login and when prompted, add the SharePoint Online tenancy you wish to connect to.
Select Modern Page from the document type dropdown, select the Modern page library to publish to (in this case it is Site Pages), enter the Name and Title and select Save.
Live Publish will convert your Word document with table of contents and heading styles to clickable anchor links.
Please note that the heading links in the screen above are anchor links. On clicking the headings, it positions the user to the corresponding heading on the modern page. This feature is currently not possible out-of-the-box with modern page editing.
Please be aware that even though Live Publish will create the page correctly with the anchors and bookmarks working, on editing of this page (post publishing) the anchor references are removed. We are unsure as to why this happens; our best guess is that Microsoft’s modern page editor (CKeditor) removes the “id” attributes from the heading styles.
Unless this changes and the stripping out of the “id” attribute is reversed, there’s nothing we can do post-publishing edit of modern page – I need to make this very clear as I don’t want folks thinking we are making false claims.
What you miss out from without anchors working?
So whilst Live Publish can create anchors and bookmark allowing user to click-through to these references, there is a major caveat. If you never post-edit the page curated via Live Publish – no problem!
The fact is (at the moment) modern page editing does not allow the HTML tags to be modified and therefore things like anchors and bookmarks can only be added programmatically (which is what Live Publish does).
If you are a user of a Modern SharePoint Communication or Team sites or simply building modern content in Classic SharePoint Site Pages libraries, please consider Live Publish as an easier way to build and manage your modern content.
For more information on how this works, please email email@example.com.