Another common need for content teams is the ability to link to different sections within the same page. This makes sharing links to exactly the right content a lot more user-friendly. TinyMC has this use case covered too. And the way we do it is with the Anchor plugin.
Back in our IDE, let's install the Anchor plugin and add a button for it in the toolbar. To test this out, let's add an anchor to the How It Works heading. this will become the ID of the anchor added to the page. So I prefer to give it a slug format of the actual text that we're linking to, but it could really be any valid ID that you'd like.
Now, if someone were to link to our site with the hashtag how it works on the end of the URL, then the page would automatically scroll to the proper position. We can even add links to this anchor within another part of our page. For example, let's add a button to our hero section. This time we'll make it a learn more button.
Then we'll link it to our newly created anchor. If I command click on the button now, you'll see it goes exactly where it should. By the way, holding the command button while clicking was only necessary in the context of the editor. The output HTML that you end up serving to your end user wouldn't require command to be pressed.
Anchors certainly are easy enough to implement, but they are also a huge win for making your content more organized and easily shareable. Any CMS worth its salt would certainly want to implement them. Another common need for content teams is the ability to link to different sections within the same page. This makes sharing links to exactly the right content a lot more user-friendly.
TinyMC has this use case covered too. And the way we do it is with the Anchor plugin. Back in our IDE, let's install the Anchor plugin and add a button for it in the toolbar. To test this out, let's add an anchor to the How It Works heading.
this will become the ID of the anchor added to the page. So I prefer to give it a slug format of the actual text that we're linking to, but it could really be any valid ID that you'd like. Now, if someone were to link to our site with the hashtag how it works on the end of the URL, then the page would automatically scroll to the proper position. We can even add links to this anchor within another part of our page.
For example, let's add a button to our hero section. This time we'll make it a learn more button. Then we'll link it to our newly created anchor. If I command click on the button now, you'll see it goes exactly where it should.
By the way, holding the command button while clicking was only necessary in the context of the editor. The output HTML that you end up serving to your end user wouldn't require command to be pressed. Anchors certainly are easy enough to implement, but they are also a huge win for making your content more organized and easily shareable. Any CMS worth its salt would certainly want to implement them.