While normally a blog post isn’t overly long, there are times when you just have to put it all into a single post. Long posts can be difficult to read, but you can include bookmarks to areas within your article and add a sort of mini table of contents at the top linking to the sections inside your post. Both the bookmark and the link to it are created using the anchor tag.
Although you may not be familiar with the HTML of the anchor tag, you have already been using it – a lot. It’s the HTML created every time you create a hyperlink to another site or location. Here’s what the HTML looks like for a basic anchor:
<a href="http://moultriecreek.us">Moultrie Creek</a>
The text the reader sees – Moultrie Creek in this example – is surrounded by opening and closing anchor (a) tags. The actual address is included in the href attribute surrounded by quotes.
That’s simple enough. Now let’s look at the anchor tag for a bookmark:
<a name="section_b">Section B</a>
Here, the name attribute is used and its contents should always be a single string of text – no spaces – and again surrounded by quotes.
Once you’ve created the bookmark, linking to it is a simple process.
<a href="http://moultriecreek.us/gazette/?p=2861#section_b">Go to Section B</a>
The href attribute is used to link to the page and the text string from the bookmark’s name attribute is tacked to the end of it with a hash mark (#) separating it from the page address. Don’t forget to surround everything with quotation marks.
While the bookmark is mostly used as a table of contents for a long page, it’s not the only use. You can link to a bookmark from anywhere. Follow the link below and you’ll be taken to the section on Research Focus at my About page.
See where my research is focused.
Although bookmarks are a bit of a pain to create, they can be a very handy way to point your readers to specific information or sections within your articles. With a little practice, you’ll be popping out bookmarks like a pro.