in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Toth’s Tales from the Trenches

Practical SharePoint experience articles, tips, and frustrated rants and ravings.

Using named anchors in SharePoint Wiki pages

If you've ever tried to add a named anchor hyperlink in a MOSS/SharePoint Wiki page, you'll find that the SharePoint rich text editor does not support adding named anchors (hyperlinks to areas in the same HTML document) via the toolbar buttons (you'll get an error dialog). I was able to find one workaround here, but it didn't quite suit my needs. Following is possibly an easier workaround using root relative urls. To get this functionality, you first need to switch to source view and add some html code by hand.

Add Anchors

Click the source button to switch to HTML source view. Add your anchor wherever you need it in the source, for example:

<a id=”nameofanchorname=”nameofanchor></a>

When done adding anchors, click OK to go back to the rich text view.

Linking to Anchors

To create links to the anchors you just created, you can do this easily from the rich text toolbar by clicking on the Hyperlink button.

In the Hyperlink dialog, for the Address, specify the root relative URL for the page, in the following format:

/firstsubsite/secondsubsite/wiki page library name/Name of Wiki Page.aspx#nameofanchor

You can get this url by going out of edit mode on the page, and back to viewing the page in regular view mode.

  1. Copy the URL from the address bar
  2. Remove the first domain name part of the URL (e.g. http://domain.com)
  3. Add the named anchor portion (e.g. #nameofanchor) to the very end of the url.

 

Comments

 

Waldek Mastykarz said:

You can use this feature on any control with an ID on it. So a <div id="foo" works as well as <a>.

November 1, 2007 2:37 AM
 

adamtoth said:

Good point, thanks.

November 1, 2007 11:31 AM
 

Links (11/1/2007) « Steve Pietrek’s SharePoint Stuff said:

Pingback from  Links (11/1/2007) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

November 1, 2007 7:06 PM
 

Jason Blake said:

I've having some trouble implementing this. Could someone supply some snipets of html code?

November 7, 2007 2:30 PM
 

adamtoth said:

Hey Jason, can you post anything you've tried so far?

November 8, 2007 8:15 PM
 

Pablo Picasso said:

I have high hopes as I installed Telerik´s RADEDITOR. www.telerik.com/.../radeditor.aspx

That seems to be having a tool for creating anchor links - also other linking options are way better than in the native MOSS editor.

The lite-version is free for all MOSS users.

November 9, 2007 2:18 AM
 

Jason Blake said:

Actually after some experimentation I've found the following will work in MOSS 2007. The first few lines are the original hyperlink or the point from which to jump. The last few lines are further down on the webpage and designate the anchor.

<DIV>Jump to <A href="www.servername.com/.../SamplePage.aspx

.

.

.

.

.

<A id=Kanbay name=Kanbay></A>Kanbay Research Institute named blah, blah, blah inc. one of the top 10 firms in the United States among those favored by U.S. consumers.

November 14, 2007 4:07 PM
 

SharePoint 2007 Link love: 11-19-2007, part four at Virtual Generations said:

Pingback from  SharePoint 2007 Link love: 11-19-2007, part four at  Virtual Generations

November 19, 2007 8:37 AM
 

Jeahlo said:

Thanks for the info regarding the HTML hacks, especially using the id attribute in the Div tag. I had used the name attribute in a link tag, but SharePoint Wiki turned all my headings blue and underlined. Using the id attribute in the Div tag, I can preserve the formatting I orignally had.

December 18, 2007 5:42 PM
 

MG said:

Yep... <a id=”nameofanchor” name=”nameofanchor”></a> did not work for me,

but remove the quotes and it does.

Should be:

<a id=nameofanchor name=nameofanchor></a>

May 9, 2008 2:05 PM
 

Marcos said:

Great info. It changed sharepoint wikis status to "usable".

Thanks!

May 29, 2008 10:25 AM
 

icanbejason said:

I have a question, as a total rookie.  When adding these anchors, do I include the font and align info within the tag, or do I just put it around the text that will show in the read-view.

June 24, 2008 3:50 PM
 

ziera said:

thanks! it works! i was trying hard on sharepoint and finally came across this.. thanks once a gain fro sharing. :)

June 26, 2008 10:53 PM
 

BecsBouch said:

Hoooray!!!!

IT WORKS!!!

I have been trying to write an anchor and link to anchor for literally the last day - i thought it was somehow the fact that i was inept (and putting it in html wrong as i am a complete novice) but then i found this blog - you are all brilliant! thanks for sharing!

time for a well deserved cup of tea...

August 8, 2008 4:33 AM
 

jmac said:

thanks for the tip. sharepoint wiki is now less painful but I definitely miss Confluence.

August 15, 2008 11:45 AM
 

GillesGarcia said:

Hi, Likely the most stupid question of the year, but i have to ask...

Is there a way to get the url of a web part.

I mean i'm composing pages using several Common Editor Web Parts and i'd like to be able to provide my own hand-made TOC. Thus i need to be able to point to each and every CEWP....  the tip to insert <A name=""> works fine (while we may expect something more sophisticated).

BUT as soon as i use some other web parts (e.g. Links) this trick doesn't work anymore....

Any idea how to "point to a web part"?  

Thanks !

September 9, 2008 4:21 AM
 

Agiraffe said:

Hi, now I am a complete newcomer to SharePoint and this is my first time doing anything but reading a wiki site. I was wondering, is it possible to integrate a search facility into my wiki site?

November 11, 2008 10:37 AM
 

Burghthing said:

>Pablo Picasso wrote:

>I have high hopes as I installed Telerik´s RADEDITOR.

I'm using that tool and unfortunately it does not work.  When you try to reference the bookmark it refers to the edit mode of the wiki page.  You can work around that by relative referencing I guess, but then you're back to editing the HTML again.

November 18, 2008 3:25 PM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts