Skip to content

Commit 888de9a

Browse files
authored
Add button shortcode (#483)
* Add: button shortcode * Add: (button) Outline-style examples
1 parent c67a70d commit 888de9a

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

layouts/shortcodes/button.html

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{{/*
2+
3+
doc: Create button links in various styles.
4+
5+
{{< button info >}}
6+
label: Info
7+
link: http://example.com/
8+
{{< /button >}}
9+
10+
{{< button success >}}
11+
label: Success
12+
link: http://example.com/
13+
{{< /button >}}
14+
15+
{{< button warning >}}
16+
label: Warning
17+
link: http://example.com/
18+
{{< /button >}}
19+
20+
{{< button danger >}}
21+
label: Danger
22+
link: http://example.com/
23+
{{< /button >}}
24+
25+
{{< button muted >}}
26+
label: Muted
27+
link: http://example.com/
28+
{{< /button >}}
29+
30+
{{< button light >}}
31+
label: Light
32+
link: http://example.com/
33+
{{< /button >}}
34+
35+
{{< button dark >}}
36+
label: Dark
37+
link: http://example.com/
38+
{{< /button >}}
39+
40+
<p>
41+
42+
{{< button outline-info >}}
43+
label: Info
44+
link: http://example.com/
45+
{{< /button >}}
46+
47+
{{< button outline-success >}}
48+
label: Success
49+
link: http://example.com/
50+
{{< /button >}}
51+
52+
{{< button outline-warning >}}
53+
label: Warning
54+
link: http://example.com/
55+
{{< /button >}}
56+
57+
{{< button outline-danger >}}
58+
label: Danger
59+
link: http://example.com/
60+
{{< /button >}}
61+
62+
{{< button outline-muted >}}
63+
label: Muted
64+
link: http://example.com/
65+
{{< /button >}}
66+
67+
{{< button outline-light >}}
68+
label: Light
69+
link: http://example.com/
70+
{{< /button >}}
71+
72+
{{< button outline-dark >}}
73+
label: Dark
74+
link: http://example.com/
75+
{{< /button >}}
76+
77+
*/}}
78+
79+
{{ $button_style := .Get 0 }}
80+
{{ $button_data := transform.Unmarshal .Inner }}
81+
{{ $button_label := $button_data.label }}
82+
{{ $button_link := $button_data.link }}
83+
84+
<a href="{{$button_link}}"><span class="sd-btn sd-btn-{{$button_style}}">{{$button_label}}</span></a>

0 commit comments

Comments
 (0)