Tuesday, August 7, 2012

SharePoint 2010 - How to easily create links to existing SharePoint content in HTML Editor

What?

How to easily create links to existing SharePoint content in HTML Editor using [[ and Ctrl+Space?

 Why?

It is a common requirement to provide links to existing pages/documents/list items in SharePoint sites. This is especially true with wikis and publishing sites.

How?

While it is not difficult to copy the actual content urls manually, SharePoint 2010's HTML Editor offers a quick and convenient way to create links to existing content. This is especially useful when there is a need to create a new page during content contribution.

SharePoint offers quick and easy ways to link to existing content and also to mark a piece of text as one that should have a page created for it. SharePoint then turns terms into special links, that, when clicked, allow the user to create pages for the terms. The following sections explain how to use wiki notation to achieve these two simple tasks.

Limitation: This feature does not work within Content Editor Web Parts!

Linking to Existing Content

To link to existing content while typing text in a wiki page, type [[. This opens a pop-up menu that shows a list of existing pages available in the site (see Figure 1). To link to one of these pages, simply select it from the menu and add ]]. The item is added to the text as [[pagename]], and when you save the document, this is transformed into a link to that page.

Figure 1. Typing [[ a wiki page opens a pop-up menu that allows you to quickly link to another page.


The menu also offers two special options at the bottom: List and View. Selecting one of these is the same as typing [[List: or [[View:. You can then start typing either the name of the list or the view that is in the current site, and SharePoint autocompletes the name of the list as you type it or allows you to choose a list and then an item or view (depending on whether you selected List or View in the first level, as shown in Figure 2).

Figure 2. When you start typing the list name, SharePoint shows you the lists you can choose from.


As before, the text shows as [[List:listname]], and this transforms into a link to the list or view when you save the page. For example, [[List:Sample List]] shows up in the page as the name of the list (Sample List), and it is linked to the list. Typing [[List:Sample List/1|sample item]] links to the item in the list Sample List with the title Sample Item, as shown in Figures 2 and 3.

Figure 3. The syntax to link to a list item in a list.



Figure 4. The link is shown as the list item’s title.




Tip: If the pop-up menu does not appear, press Ctrl+space to force it to show up.


Creating New Pages

If you are writing something and realize that a certain word or term in your text should link to a page that needs to be created, you don’t need to stop and create it right away. Instead, you can use the wiki syntax to mark it as a link and then create it later—or let someone else create it. To do this, simply type the term you want to make into a link inside double square brackets. For example, if you write [[Product X]], the words Product X appear on the page as a link, even if there is no page for that product.

When you save the page, the link looks different from other links; it is underlined with a black dotted line, as shown in Figure 5. Clicking this link opens the New Page dialog, which allows you (or other users) to quickly create a page for the word (or words) you wrote, as shown in Figure 6a and Figure 6b. The new page dialog is generated based on the kind of the site where the page is created. If the site in which the new page is created is a publishing site / has publishing feature activated, then a new publishing page will be created in the pages library else a wiki page will be created by default in the site pages library.

Figure 5. A link to a page that doesn’t exist yet is marked with a black dotted underline.


Figure 6a. The New Page Dialog for a new page link.



Figure 6b. The New Page dialog for a wiki link.


References: http://mscerts.programming4.us/sharepoint/SharePoint%202010%20%20%20Use%20Wiki%20Syntax%20to%20Link%20to%20Existing%20Content%20and%20Create%20Pages.aspx

1 comment:

  1. There is a bug in editor it seems...

    The problem occurs when you try to [[ after you have written a text and want to [[ a word in within the existing text. Then SharePoint moves the cursor to the last word in the paragraph and it says "Items does not exists..".

    ReplyDelete