freedom

Links

Gautham Chettiar Est. 2 Mins ( 250 Words )

Render accessible hyperlinks using the widgets/link.html partial.

This is the partial implementation of links. For the markdown/shortcode syntax, check Links documentation.

Features#

Parameters#

url#
(required) The destination URL. External http(s):// URLs are opened in a new tab automatically.
text#
(optional) The visible link text rendered inside the <a> tag.
title#
(optional) Tooltip text shown on hover.
class#
(optional) CSS class(es) applied to the <a> element (default: fr-link).

Syntax#

go-html-template
{{ partial "widgets/link.html" (dict
    "url"   "https://gohugo.io"
    "text"  "Hugo"
    "title" "Official Hugo website"
    "class" "my-link"
) }}

Examples#

go-html-template
{{ partial "widgets/link.html" (dict
    "url"  "/guide/theme-customization/"
    "text" "Theme Customization"
) }}

External links (absolute http(s):// URLs) automatically open in a new tab and display an external-link icon.

go-html-template
{{ partial "widgets/link.html" (dict
    "url"  "https://gohugo.io/documentation/"
    "text" "Hugo Documentation"
) }}
go-html-template
{{ partial "widgets/link.html" (dict
    "url"   "https://gohugo.io/documentation/"
    "text"  "Hugo Documentation"
    "title" "Official Hugo Docs"
) }}

Providing a class replaces the default fr-link class. Include fr-link explicitly if you want to keep the default styling alongside your own class.

go-html-template
{{ partial "widgets/link.html" (dict
    "url"   "https://gohugo.io"
    "text"  "Hugo"
    "class" "fr-link my-custom-link"
) }}