Generates a normalized link given a path and other conditions.
- Namespace
- Statiq.Common
- Containing Type
- ILinkGenerator
Syntax
string GetLink(string path, string host, string root, string scheme, string[] hidePages, string[] hideExtensions, bool lowercase, bool makeAbsolute, bool hiddenPageTrailingSlash)
Parameters
Name |
Type |
Description |
path |
string |
The path to get a link for. |
host |
string |
The host for the link (or null to omit the host). |
root |
string |
The root path for the link (or null for no root path). |
scheme |
string |
The scheme for the link (or null for "http"). |
hidePages |
string[] |
An array of file names to hide (or null to not hide any files). |
hideExtensions |
string[] |
An array of file extensions to hide (or null to not hide extensions or an empty array to hide all file extensions). |
lowercase |
bool |
Indicates that the link should be rendered in all lowercase. |
makeAbsolute |
bool |
If path is relative, setting this to true will assume the path relative from the root of the site
and make it absolute by prepending a slash and root to the path. Otherwise, false will leave relative paths as relative
and won't prepend a slash (but host, scheme, and root will have no effect).
If path is absolute, this value has no effect and host, scheme, and root
will be applied as appropriate.
|
hiddenPageTrailingSlash |
bool |
Indicates that a trailing slash should be appended when hiding a page due to hidePages.
Setting to false means that hiding a page will result in the parent path without a trailing slash.
|
Return Value
Type |
Description |
string |
A generated link. |