freedom

Links

Gautham Chettiar Est. 3 Mins ( 486 Words )

A link element rendered using standard markdown link syntax and alternative shortcode {{< link >}}.

Features#

Syntax#

[link text](url "optional tooltip title")
{{< link
        url="url"
        text="link text"
        title="optional tooltip title"
        class="custom-class"
>}}

Parameters#

Link Text / text
(required) The visible, clickable text of the link.
URL / url
(required) The destination URL. Can be one of:
  • Internal path: a relative or root-relative path within the site (e.g., /guide/markdown-syntax/)
  • External URL: an absolute http:// or https:// URL (e.g., https://gohugo.io) — automatically opens in a new tab
  • Page anchor: a fragment pointing to a heading on the same page (e.g., #features)
Title / title
(optional) Tooltip text displayed on hover.
class (shortcode only)
(optional) One or more CSS classes to apply to the <a> element (default: fr-link).

Note: The class attribute is not available in markdown syntax due to a goldmark limitation — inline elements do not support attribute blocks {...}. use shortcode if you need custom classes.

Theming#

The link component uses the CSS custom property,

assets/css/theme.scss
{
  :root {
    // ...
    --color-link: #0000ee;
    --color-accent: #01827c;
    
    // ...
  }

  @media (prefers-color-scheme: dark) {
    :root {
      // ...
      --color-link: #66aaff;
      --color-accent: #00fff2;
      // ...
    }
  }
}

Refer to the Theme Customization guide, for guidance on how to customize these properties for your site.

Examples#

[Theme Customization](/guide/theme-customization/)
{{< link url="/guide/theme-customization/" text="Theme Customization" >}}

Theme Customization

External links are detected automatically when the URL is an absolute http(s):// address. They open in a new tab and display a small external-link icon.

[Hugo Documentation](https://gohugo.io/documentation/)
{{< link url="https://gohugo.io/documentation/" text="Hugo Documentation" >}}

Hugo Documentation

Pass an optional title to show a tooltip on hover.

[Hugo Documentation](https://gohugo.io/documentation/ "Official Hugo Docs")
{{< link url="https://gohugo.io/documentation/" text="Hugo Documentation" title="Official Hugo Docs" >}}

Hugo Documentation

Link to a specific heading on the same page using a #fragment.

[Back to Features](#features)
{{< link url="#features" text="Back to Features" >}}

Back to Features

Use the class parameter to apply custom CSS classes. This is only possible via the shortcode — markdown inline links do not support attribute blocks.

markdown
{{< link url="https://gohugo.io/documentation/" text="Hugo Documentation" class="my-custom-link" >}}
Hugo Documentation

The default class fr-link is replaced entirely when class is provided. Include fr-link in your value to preserve the default styling (e.g. class="fr-link my-custom-link").