mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-30 03:03:09 +00:00
Merge branch 'main' of https://github.com/TB1234/hugo-theme-relearn into TB1234-main
This commit is contained in:
commit
16716ff1db
3 changed files with 13 additions and 1 deletions
|
@ -52,6 +52,7 @@ Once the button is clicked, it opens another browser tab for the given URL.
|
|||
| **icon** | see notes | [Font Awesome icon name]({{%relref "cont/icons#finding-an-icon" %}}) set to the left of the title. Depending on the **style** there may be a default icon. Any given value will overwrite the default.<br><br>- for severity styles: a nice matching icon for the severity<br>- for all other colors: _<empty>_<br><br>If you want no icon for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces) |
|
||||
| **iconposition** | `left` | Places the icon to the `left` or `right` of the title. |
|
||||
| _**<content>**_ | see notes | Arbitrary text for the button title. Depending on the **style** there may be a default title. Any given value will overwrite the default.<br><br>- for severity styles: the matching title for the severity<br>- for all other colors: _<empty>_<br><br>If you want no title for a severity style, you have to set this parameter to `" "` (a non empty string filled with spaces) |
|
||||
| **target** | _blank | The destination frame/window for the URL. |
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -134,6 +135,15 @@ Once the button is clicked, it opens another browser tab for the given URL.
|
|||
|
||||
{{% button href="https://gohugo.io/" icon="dragon" style="warning" %}}Get Hugo{{% /button %}}
|
||||
|
||||
### Target
|
||||
|
||||
````go
|
||||
{{%/* button href="https://gohugo.io/" target="_self" %}}Get Hugo in same window{{% /button */%}}
|
||||
{{%/* button href="https://gohugo.io/" %}}Get Hugo in new Window/Frame (default){{% /button */%}}
|
||||
````
|
||||
{{% button href="https://gohugo.io/" target="_self" %}}Get Hugo in same Window/Frame{{% /button %}}
|
||||
{{% button href="https://gohugo.io/" %}}Get Hugo in new Window/Frame (default){{% /button %}}
|
||||
|
||||
### Other
|
||||
|
||||
#### Severity Style with all Defaults
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
{{- $content := .content }}
|
||||
{{- $href := .href }}
|
||||
{{- $style := .style | default "transparent" }}
|
||||
{{- $target := .target | default "_blank" }}
|
||||
{{- $title := .title | default ($content) | default ($style | T) }}
|
||||
{{- $icon := .icon | default "" }}
|
||||
{{- if and (not $icon) (eq (len $icon) 0) }}
|
||||
|
@ -17,7 +18,7 @@
|
|||
{{- $iconposition := .iconposition | default "left" }}
|
||||
{{- with $context }}
|
||||
<span class="btn cstyle {{ $style }}">
|
||||
<a{{ if $href }} href="{{ $href }}" target="_blank"{{ end }}>
|
||||
<a{{ if $href }} href="{{ $href }}" target="{{ $target }}"{{ end }}>
|
||||
{{- if and $icon (eq $iconposition "left") }}
|
||||
<i class="{{ $icon }}"></i>
|
||||
{{- end }}
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
"iconposition" ((.Get "iconposition") | default (.Get "icon-position"))
|
||||
"style" (.Get "style")
|
||||
"title" (.Get "title")
|
||||
"target" (.Get "target")
|
||||
) }}
|
Loading…
Reference in a new issue