Translate me ...

What Are These? ... Read more about them, here!

16 July 2009

Anchor Links within a post

ANCHOR LINKS


My friend, the Nitecruzr, once told me; "Anchors are simple - make an anchor - and link to it!" Of course, then he told me about the W3 School and gave me the link to find out, myself! He was correct, though! They are.

It is important to know how to link from one specific point in your post, or a specific theme/word in your post, to something in another part of your Blog post.

With me so far?


'Internal' anchor links work especially well, when there is a lot of information on a page, or sections of a page, and you wish to refer the reader back to a previous point.


Unlike URL Hyperlinks, to make Anchor Links, you have to use the HTML Editor, as opposed to the Compose, or WYSIWYG (What You See Is What You Get) Post Editor, to 'set' the 'anchor tag'...

<a name="Linkhere">Linkhere</a>



The 'Triggers', or 'HyperLinks', to the Anchor tags, look like this:

<a href="http://blogging.robertosblogs.net/2009/07/anchor-links-within-post.html#Target Anchor Word


Let's say I want to link back to the first part of this post, to the word - ANCHOR - at the top. The first thing I do, is to set the 'Target', if you will, - the Anchor point. That looks like this:

<a name="ANCHOR">ANCHOR</a>

and I place it, by typing it into the 'HTML' Editor, as the following image shows ...





Then, I link to it by selecting a word to use as a hyperlink - say, from <HERE>

The hyperlink tag will look like this:-

<a href="http://blogging.robertosblogs.net/2009/07/anchor-links-within-post.html#ANCHOR">HERE</a>

Or,
An easier, less complicated version, is to do away with the URL, and simply use the 'hash #' sign. Let me show you.

Your anchor, which, in this case, is the word 'Internal', from the fourth paragraph above - would look like this: <a name="Internal">Internal</a> - and your hyperlink to it, would look like this: <a href="#Internal">Internal</a>

See the hash # ?


Another one might be to link back to the paragraph where I mentioned WYSIWYG.

I've set the anchor, <a name="WYSIWYG">WYSIWYG</a>

and here is the link -

<a href="http://blogging.robertosblogs.net/2009/07/anchor-links-within-post.html#WYSIWYG">here</a>

Sans URL would be: <a href="#WYSIWYG">here</a>

N.B. - As the owner of the Blog, you should know where your Anchors are. If so, then you can also access them from 'outside'. In other words, you can link to the salient 'tags' from another Blog, or post, with the correct Hyperlink URL - as above. For example, I know where a 'tag' is in my Photos Blog, for Hong Kong Harbour. Click <here>.


There you have it. Internal Anchor Links - a vital weapon in the armoury of a busy Blogger.


TOP

12 COMMENTS:

Mandy and Jack said...

Thank you so much for this!! It's exactly what I needed!

Viviscents said...

Hi. Spent countless hours fumbling on over this thing. Thank you very much for this post.

Kristina said...

I still can't get it to work. Blogger is adding href="" to my <a name="anchor" tag. I tried adding my page address to that as well but when I click on my link nothing happens. I'm sure blogger hates me :(

Roberto said...

Hi Kristina

Please re-read my post - you must be missing something. They're tricky little rascals, until you get it right!
Don't forget, you have to be in html editor, not compose mode.

Johanna GGG said...

Hi roberto - just wanted to say thanks for your advice - this seems to work for me - blogger does put in some html that doesn't mean much to me but I am not questioning it as long as the anchors work

Roberto said...

Hi Johanna

Thanks for that. Good luck with your blog - I'll pop in and see it, later.

Timothy J. Schutte said...

Thanks for the tip, Roberto!

Roberto said...

You're welcome, one and all!

Deirdre said...

Thanks so much! Spent way too much time trying and finally got it, thanks to this post.

Matt Blick said...

Really helpful and solved the problem, though i didn't understand a word of it, but I copied and pasted your links into my blog and changed the urls!

It works.

Just a suggestion.

I've looked up a couple of answers to this problem and everyone uses the post itself as an example.


"I'm hyperlinking to the word hyperlink, and the anchor is anchoring to the hyperlink of the word anchor..." you get the picture.

That's like teaching surgery by operating on yourself!

It would be clearer if you were demonstrating on text about puppies or something.

Deirdre said...

This was working great for me, but now when I add this code, after publishing, Blogger adds
href="http://www.blogger.com/"
between <a name
which causes the anchor to become a link to a nonexistant webpage. I've deleted it numerous times and it keeps popping up. I keep rechecking my code and don't see any errors. Any ideas?

Roberto said...

Hi Deirdre

I've noticed the same thing, in recent months. It's a Blogger editor thing. The code is OK, though.
I don't know why, but I have had to edit many times, and it stems from my bad habit of swapping from 'edit html' editor to 'Compose' mode editor.
I asked a friend of mine, Nitecruzr, and he suggested the same thing.
When I don't swap, it doesn't happen.
I hope that helps.

Email Contact



Courtesy of Nexodyne

CONTRIBUTORS' PROFILES