Skip to content

Commit 10036bb

Browse files
paulOsinskiclaude
andcommitted
Add Pro badge to sidebar items with audience: pro
Render a small "Pro" badge next to sidebar entries whose page has audience: pro, styled with the existing Torii Orange brand color used by the version selector (with a dark-mode variant). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 909e4cf commit 10036bb

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

docs/assets/scss/common/_custom.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,22 @@ h1, h2, h3, h4, h5, h6,
210210
display: none;
211211
}
212212

213+
// Pro badge — appears next to sidebar items with audience: pro
214+
.pro-badge {
215+
display: inline-block;
216+
margin-left: 0.5em;
217+
padding: 0.05em 0.45em;
218+
border: 1px solid #F2561D;
219+
border-radius: 0.25rem;
220+
background-color: rgba(#F2561D, 0.72);
221+
color: #fff;
222+
font-size: 0.7em;
223+
font-weight: 500;
224+
line-height: 1.4;
225+
vertical-align: middle;
226+
white-space: nowrap;
227+
}
228+
213229
// ============================================================
214230
// Cards
215231
// ============================================================
@@ -419,6 +435,12 @@ h1, h2, h3, h4, h5, h6,
419435
border-color: #F2762E;
420436
}
421437

438+
// Pro badge in dark mode
439+
.pro-badge {
440+
background-color: rgba(#F2561D, 0.85);
441+
border-color: #F2762E;
442+
}
443+
422444
// Selection color in dark mode
423445
::selection {
424446
background-color: rgba(#82B0D9, 0.3);

docs/layouts/_partials/sidebar/render-section-menu.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
{{- $linkContent = . }}
3232
{{- end }}
3333

34+
{{- /* Pro badge for nodes whose page is marked audience: pro */ -}}
35+
{{- $proBadge := "" -}}
36+
{{- with $node.Page }}
37+
{{- if eq .Params.audience "pro" }}
38+
{{- $proBadge = `<span class="pro-badge" aria-label="Pro feature">Pro</span>` -}}
39+
{{- end }}
40+
{{- end }}
41+
3442
{{- $ariaCurrent := "" -}}
3543
{{- $liClass := "" -}}
3644

@@ -47,7 +55,7 @@
4755
<li {{- with $liClass }} class="{{ . }}" {{ end -}}>
4856
{{- with $node.Page.Pages }}
4957
<details{{- with $ariaCurrent }} open{{- end }}{{- if ne $node.Page.Params.sidebar.collapsed true }} open{{- end }}>
50-
<summary>{{ $linkContent }}</summary>
58+
<summary>{{ $linkContent }}{{ $proBadge | safeHTML }}</summary>
5159
<ul class="list-unstyled list-nested">
5260
{{- range . }}
5361
{{- template "walk" (dict "node" . "currentPage" $currentPage "version" $version) }}
@@ -56,7 +64,7 @@
5664
</details>
5765
{{- else }}
5866
{{- if $node.Page }}
59-
<a {{- with $ariaCurrent }} aria-current="{{ . }}" {{- end }} href="{{- $node.Page.RelPermalink }}">{{ $linkContent }}</a>
67+
<a {{- with $ariaCurrent }} aria-current="{{ . }}" {{- end }} href="{{- $node.Page.RelPermalink }}">{{ $linkContent }}{{ $proBadge | safeHTML }}</a>
6068
{{- else }}
6169
{{- /* Menu-only item with no page */ -}}
6270
{{ $linkContent }}

0 commit comments

Comments
 (0)