Skip to content

Commit 294a7e3

Browse files
components: add deprecated badge
Signed-off-by: Craig Osterhout <[email protected]>
1 parent c152b60 commit 294a7e3

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

content/contribute/components/badges.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,39 @@ toc_max: 3
1111
{{< badge color=red text="red badge" >}}
1212
{{< badge color=green text="green badge" >}}
1313
{{< badge color=violet text="violet badge" >}}
14+
{{< badge color=gray text="gray badge" >}}
1415

1516
You can also make a badge a link.
1617

1718
[{{< badge color="blue" text="badge with a link" >}}](../_index.md)
1819

1920
### Usage guidelines
2021

21-
We use badges to indicate new content and product content in various stages of the release lifecycle:
22+
We use badges to indicate new content and product content in various stages of the release lifecycle:
2223

2324
- The violet badge to highlight new early access or experimental content
2425
- The blue badge to highlight beta content
2526
- The green badge to highlight new content that is either GA or not product-related content, such as guides/learning paths
27+
- The gray badge to highlight deprecated content
2628

27-
Best practice is to use this badge for no longer than 2 months post release of the feature.
29+
Best practice is to use this badge for no longer than 2 months post release of the feature.### Markup
2830

29-
### Markup
31+
Inline badge:
3032

3133
```go
3234
{{</* badge color=amber text="amber badge" */>}}
3335
[{{</* badge color="blue" text="badge with a link" */>}}](../overview.md)
3436
```
37+
38+
Sidebar badge in frontmatter:
39+
40+
```yaml
41+
---
42+
title: Page title
43+
params:
44+
sidebar:
45+
badge:
46+
color: gray
47+
text: Deprecated
48+
---
49+
```
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
layouts/partials/components/badge.html
12
{{- $colors := (dict
23
"amber" "bg-amber-500 dark:bg-amber-400"
34
"blue" "bg-blue-500 dark:bg-blue-400"
5+
"gray" "bg-gray-500 dark:bg-gray-400"
46
"green" "bg-green-500 dark:bg-green-700"
57
"red" "bg-red-500 dark:bg-red-400"
68
"violet" "bg-violet-500 dark:bg-violet-400"
79
)
810
-}}
911

1012
{{- if not (isset $colors .color) -}}
11-
{{- errorf "[badge] wrong color name: '%s' - supported values: amber, blue, green, red, violet" .color -}}h
13+
{{- errorf "[badge] wrong color name: '%s' - supported values: amber, blue, gray, green, red, violet" .color -}}h
1214
{{- end -}}
1315

1416

1517
<span
1618
class="not-prose {{ index $colors .color }} rounded-sm px-1 text-xs text-white"
17-
>{{ .content }}</span
18-
>
19+
>{{ .content }}
20+
</span>

0 commit comments

Comments
 (0)