Skip to content

Commit

Permalink
Select custom label or hide label in selectors (#256)
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
recrwplay authored Aug 28, 2024
1 parent 83c66a0 commit 61bf909
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions preview-src/labels.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
= Labels
:page-selector-label: Custom version label
// :page-selector-hide-label: true


== All the labels
Expand Down
2 changes: 1 addition & 1 deletion src/partials/nav-selectors.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{{#if (eq this.version @root.page.version)}} selected{{/if}}
{{~#if this.missing}} disabled{{/if}}
>
Version {{ this.displayVersion }}{{#if (and @root.page.attributes.nav-indicate-latest (eq this.version @root.page.latest.version)) }} (latest){{/if}}
{{#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}}
</option>
{{/unless}}
{{/each}}
Expand Down

0 comments on commit 61bf909

Please sign in to comment.