Gets an anchor HTML element for the specified document using the document destination.
Note that you can optionally include the host or not depending
on if you want to generate host-specific links. By default, the host is not included so that
sites work the same on any server including the preview server.
Syntax
public static IHtmlContent DocumentLink(this IHtmlHelper htmlHelper, IDocument document, string queryAndFragment, string linkText, bool includeHost)
Parameters
Name |
Type |
Description |
htmlHelper |
IHtmlHelper |
The HTML helper. |
document |
IDocument |
The document to generate an anchor element for. |
queryAndFragment |
string |
Appends a query and/or fragment to the document path. If a value is provided for this parameter
and it does not start with "?" or "#" then it will be assumed a query and a "?" will be prefixed.
|
linkText |
string |
The title to use for the anchor, or null to use the document title. |
includeHost |
bool |
If set to true the host configured in the output settings will
be included in the link, otherwise the host will be omitted and only the root path will be included (default).
|
Return Value
Type |
Description |
IHtmlContent |
A string representation of the path suitable for a web link.
|