2025-02-07 21:24:42 +01:00
+++
2025-03-21 10:14:12 +01:00
categories = ['explanation', 'howto']
description = 'How to extend link effects'
options = ['linkEffects']
title = 'Link Effects'
2025-02-07 21:24:42 +01:00
weight = 3
+++
This page shows you, how to configure custom [link effects ](authoring/markdown#link-effects ) on top of existing ones.
2025-02-08 18:53:53 +01:00
This setting can also [be overridden by your front matter ](authoring/linking/linkeffects ).
2025-02-07 21:24:42 +01:00
If you don't configure anything in your `hugo.toml` , the link effects default to
## Default Values
{{< multiconfig > }}
2025-03-21 12:27:29 +01:00
linkEffects.download = false
linkEffects.target = false
2025-02-07 21:24:42 +01:00
{{< / multiconfig > }}
## Configuration
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} You can change these settings in your `hugo.toml` and add arbitrary custom effects as boolean values (like `bg-white` in the below snippet).
2025-03-21 12:27:29 +01:00
{{< multiconfig file = hugo section = params > }}
linkEffects.bg-white = true
linkEffects.target = '_blank'
2025-02-07 21:24:42 +01:00
{{< / multiconfig > }}
This would result in
{{< multiconfig > }}
[linkEffects]
2025-03-21 12:27:29 +01:00
linkEffects.bg-white = true
linkEffects.download = false
linkEffects.target = '_blank'
2025-02-07 21:24:42 +01:00
{{< / multiconfig > }}
### Example
With this configuration in effect, the following URL
````markdown {title="Markdown"}
[Magic in new window ](images/magic.gif )
````
would result in
````html {title="HTML"}
< a href = "/images/magic.gif?target=_blank" target = "_blank" class = "bg-white" > Magic in new window< / a >
````
## Styling Effects
If the resulting effect value is `true` a class with the effect's name will be added.
Styles for default effects are contained in the theme. Add styles for your custom effects to `layouts/partials/content-header.html` .
For the above custom effect you could add the following style:
````html {title="layouts/partials/content-header.html"}
< style >
a.bg-white {
background-color: white;
}
< / style >
````