Page.PersonHREF Example

Overview

A common question from Second Site users is how to create person links in user-controlled content such as a paragraph of text on the main page. Links can be constructed via Person Link User Items, and that's the best method when adding a link to the main menu or to a list on a Custom Page. In other content, such as the static content properties or the Main Content property of a Custom Page, the Person Link User Item is not available.

Links can be constructed completely manually via HTML, but that is error-prone; changes to site properties or the genealogy data can change the page number of person page entries which will break manually constructed links. It's better to construct the link using a combination of HTML and the Page.PersonHRef() script function.

Page.PersonHREF() Links

The Page.PersonHREF() function helps create links to people. It relies on Second Site knowing the proper URL for any person on the site. If you change the number of people per page or other properties of the site, Second Site will automatically adjust the URL when you re-make the site.

You can add a link by adding the following text anywhere that Second Site accepts script statements:

<a href="<%=Page.PersonHREF(2)%>">Person's Name</a>

In the example above, "2" should be replaced by the ID of the person to whom the link should lead.

Where Page.PersonHREF() Is Valid

You can use the Page.PersonHREF() function anywhere that Second Site accepts script statements, which includes:

Any of the Custom Page User Item properties, including the Main Content property.