Create anchor links for your blog post

Contributors

@brandon-leuangpaseuth


Business Benefits

Reduce scrolling and improve user experience for your blog posts.


Divide your blog post into the main sections and decide where you want your readers to jump to.

Anchors can be added to any text, including headings and paragraph text. For example, you might want to include a contents list at the start of a long article and allow readers to jump to the section that interests them.

Add an ID to the heading or paragraph you want readers to jump to by editing the HTML.

Your HTML code should look like this:
Part 3: Layers

If you’re using the base block editor in WordPress, you can also set an anchor ID in the advanced settings for a block.

To link to an external page, select the text for your link and add a hyperlink as you normally would, but append # and the ID you added in the previous step.

For example: <https://example.com/article#manually-create-anchor-links-wordpress&gt;

To link within the same article, using the contents list mentioned previously, you don’t need the URL, just # and the anchor ID.

For example: #manually-create-anchor-links-wordpress

Check that the anchor name in the referring link, and the ID attribute on the anchor are exactly the same.

Test your link by previewing the article and clicking on the referring link.

Last edited by @hesh_fekry 2023-11-14T12:35:34Z