mirror of https://github.com/dapr/docs.git
Merge pull request #1897 from dapr/aacrawfi/button-fix
Update button shortcode so links open in new tab
This commit is contained in:
commit
efeb4cb0e5
|
@ -334,6 +334,8 @@ The shortcode would be:
|
||||||
|
|
||||||
To create a button in a webpage, use the `button` shortcode.
|
To create a button in a webpage, use the `button` shortcode.
|
||||||
|
|
||||||
|
An optional "newtab" parameter will indicate if the page should open in a new tab. Options are "true" or "false". Default is "false", where the page will open in the same tab.
|
||||||
|
|
||||||
#### Link to an external page
|
#### Link to an external page
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -346,10 +348,10 @@ To create a button in a webpage, use the `button` shortcode.
|
||||||
|
|
||||||
You can also reference pages in your button as well:
|
You can also reference pages in your button as well:
|
||||||
```
|
```
|
||||||
{{</* button text="My Button" page="contributing" */>}}
|
{{</* button text="My Button" page="contributing" newtab="true" */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
{{< button text="My Button" page="contributing" >}}
|
{{< button text="My Button" page="contributing" newtab="true" >}}
|
||||||
|
|
||||||
#### Button colors
|
#### Button colors
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
{{ $page := .Get "page" }}
|
{{ $page := .Get "page" }}
|
||||||
{{ $link := .Get "link" | default "#" }}
|
{{ $link := .Get "link" | default "#" }}
|
||||||
{{ $text := .Get "text" }}
|
{{ $text := .Get "text" }}
|
||||||
|
{{ $newtab := .Get "newtab" | default "false" }}
|
||||||
|
|
||||||
{{- if $page -}}{{- $link = ref . $page -}}{{- end -}}
|
{{- if $page -}}{{- $link = ref . $page -}}{{- end -}}
|
||||||
|
|
||||||
<a class="btn btn-{{ $color }}" href="{{ $link }}" role="button">{{ $text }}</a>
|
<a class="btn btn-{{ $color }}" href="{{ $link }}" role="button" {{- if eq $newtab "true" -}}target="_blank"{{- end -}}>{{ $text }}</a>
|
||||||
|
|
Loading…
Reference in New Issue