Have you ever wanted to link to a different section within your own blog post?
I actually always forget how to create links to different sections within my posts. I leave the code up on my desktop so that I can quickly refer back to it. Now I can clean off my desktop and just refer to this post, and so can you!
I like using links to different sections within my posts for a few reasons:
To create an index or outline for long posts.
I frequently list what will be discussed within the post at the beginning and create links so that my readers can jump down to the section they are most interested in. An example is my post on how to write a WordPress blog post
To direct people to a specific part of a post.
It’s a great feature to use if you have long posts or you discuss different elements within a post. For example: you might have a story along with a recipe you are sharing. At the beginning of the post you could put a link that says, skip to the recipe. When readers click that link, it automatically scrolls down to the recipe.
I also utilize this when sharing on social media if I want to refer someone to a specific part of the article
How to code links to jump within a post
There are two parts to creating a link to a different section within a post: the link itself and the id. The id is telling the link where to go within the post.
Here is an example:
How to write captivating content
(Try it out! When you click it you are not taken to the blog post, but to a section in the middle of the article.)
The text behind the hash tag of the URL needs to be identical to the text within the quotation marks of the id. The example above adds the id to a heading tag. You can add the id to any code; use a section of bold text or even an image.
Let’s break down the code for the URL:
- Your domain name: http://yourblog.com
- Add the post slug: http://yourblog.com/blog-post
- Add a tag: http://yourblog.com/blog-post/#tag
The link is usually placed at the top of a blog post, and the id is placed where you want the reader to jump to within the post.
How do you plan on using links to different sections within a page or post?