LinkExtensions.

GetLink(IExecutionContext, string, bool) Method

Summary

Converts the specified path into a string appropriate for use as a link using default settings from the Wyam.Common.Configuration.IReadOnlySettings. 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.
Assembly
Wyam.Common.dll
Namespace
Wyam.Common.Execution
Containing Type
LinkExtensions

Syntax

public static string GetLink(this IExecutionContext context, string path, bool includeHost = false)

Parameters

Name Type Description
context IExecutionContext The execution context.
path string The path to generate a link for.
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.
GitHub