If you like my work, please consider supporting its development.

The make_link partial was created to ensure consistent linking styles throughout the site, even if the default linking style is changed. It allows theme users to specify what kind of links they want on their site (absolute, relative, and root-relative).

Usage

The make_link partial takes a dict of two arguments:

URL

A URL to make a link out of. Relative links will be resolved relative to the base URL of the site. Absolute URLs will be left unchanged.

/path/to/static/resource
Root

A reference to the root context, so the partial can access site variables via .Root.Site.Params.

$
Start

A relative URL to use in place of the current page’s RelPermalink. This was added to work around an issue with a CSS variable path being set in the parent directory of the file using the variable, breaking the relative path.

$

Example

{{ partial "make_link" (dict "URL" "/path/to/resource" "Root" $) }}