The button shortcode generates button-styled links to direct users to other documentation pages or external resources.

Basic usage #

Use named parameters to define the destination, label, and button options:

{{< button href="/docs/latest/getting-started" name="Get started" icon="rocket" type="primary" >}}
{{< button href="https://github.com/zkreations/hudocs" name="GitHub" icon="github" >}}

Result #

Get started GitHub

Parameters #

ParameterPositionTypeRequiredDescription
href0stringYesDestination URL, internal or external.
name1stringYesVisible label. Also accepts title and text as aliases.
icon2stringNoName of a Meteor Icons icon.
type3stringNoVisual variant, such as primary or secondary.
rel4stringNoCustom value for the rel attribute.

Positional syntax #

Parameters can be provided by position in the order listed in the table:

{{< button "/docs/latest/getting-started/installation/" "Get started" "rocket" "primary" "nofollow" >}}

Variants #

Standard button #

Uses the appearance defined by the theme when no type is specified:

{{< button href="#demo" name="Download guide" >}}
Download guide

Primary button #

The primary value generates the btn-primary class:

{{< button href="#demo" name="Quick install" type="primary" >}}
Quick install

Secondary button #

The secondary value generates the btn-secondary class:

{{< button href="#demo" name="Explore features" type="secondary" >}}
Explore features

Validation #

The href attribute and the button label are required. If href is missing or none of name, title, or text is provided, Hugo stops the build and reports the missing parameter.

The shortcode delegates URL resolution and the target and rel attributes to the resolve-link partial. For internal paths, resolve-link uses relLangURL to generate the URL corresponding to the active language.