Skip to content

Commit 61bf909

Browse files
authored
Select custom label or hide label in selectors (#256)
In the version selector we currently prepend the version name (usually a number) with the word 'Version'. This PR extends the version selector to allow a choice of: - custom text - no text Two attributes are available to control the text that is displayed: - `page-selector-label` - `page-selector-hide-label` These attributes should be set in the usual way by defining in a playbook, antora.yml, or in a page header. To set custom text: ``` :page-selector-label: Custom version label ``` To have no text, ie just the version name: ``` :page-selector-hide-label: true ```
1 parent 83c66a0 commit 61bf909

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

preview-src/labels.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
= Labels
2+
:page-selector-label: Custom version label
3+
// :page-selector-hide-label: true
24

35

46
== All the labels

src/partials/nav-selectors.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{{#if (eq this.version @root.page.version)}} selected{{/if}}
2525
{{~#if this.missing}} disabled{{/if}}
2626
>
27-
Version {{ this.displayVersion }}{{#if (and @root.page.attributes.nav-indicate-latest (eq this.version @root.page.latest.version)) }} (latest){{/if}}
27+
{{#unless @root.page.attributes.selector-hide-label }}{{#with (or @root.page.attributes.selector-label 'Version') }}{{{this}}} {{/with}}{{/unless}}{{ this.displayVersion }}{{#if (and @root.page.attributes.nav-indicate-latest (eq this.version @root.page.latest.version)) }} (latest){{/if}}
2828
</option>
2929
{{/unless}}
3030
{{/each}}

0 commit comments

Comments
 (0)