Gets a link for the specified metadata using the specified metadata value and the default settings from the
configuration. This version should be used inside modules to ensure
consistent link generation. 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 string GetLink(this IExecutionState executionState, IMetadata metadata, string key, string queryAndFragment, bool includeHost = false)
Parameters
Name |
Type |
Description |
executionState |
IExecutionState |
The execution state. |
metadata |
IMetadata |
The metadata or document to generate a link for. |
key |
string |
The key at which a NormalizedPath can be found for generating the link. |
queryAndFragment |
string |
Appends a query and/or fragment to the URL from the metadata value. 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.
|
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 |
string |
A string representation of the path suitable for a web link.
|