Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
demo: show how to use multiple APIs with different sidebars configura…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
adamaltman committed Sep 29, 2021
1 parent b56d885 commit 9c55073
Show file tree
Hide file tree
Showing 18 changed files with 222 additions and 27 deletions.
15 changes: 15 additions & 0 deletions combined/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Combined sidebars

This puts multiple APIs into a single visible sidebar.

```yaml
combined:
- page: combined/index.md
- page: combined/rock.page.yaml
- page: combined/paper.page.yaml
- page: combined/scissors.page.yaml
```
:::note Pagination
We've paginated the rock, paper, and scissors APIs differently as well.
:::
12 changes: 12 additions & 0 deletions combined/paper.page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: reference-docs
definitionId: paper
settings:
pagination: section
generateCodeSamples:
languages:
- lang: curl
- lang: JavaScript
- lang: Node.js
- lang: Python
- lang: C#
- lang: Java
10 changes: 10 additions & 0 deletions combined/rock.page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type: reference-docs
definitionId: rock
settings:
pagination: none
generateCodeSamples:
languages:
- lang: curl
- lang: Go
- lang: PHP
- lang: Ruby
12 changes: 12 additions & 0 deletions combined/scissors.page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: reference-docs
definitionId: scissors
settings:
pagination: item
generateCodeSamples:
languages:
- lang: curl
- lang: JavaScript
- lang: Node.js
- lang: Python
- lang: C#
- lang: Java
33 changes: 33 additions & 0 deletions drilldown/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Drilldown style of sidebars

This shows the drilldown style of sidebars.

Notice that the `/*` is appended to the `rock.page.yaml` and `paper.page.yaml` files to avoid an extra group.
We remove the `/*` from the `scissors.page.yaml` file so you can see the difference.

```yaml
drilldown-style:
- page: drilldown/index.md
- group: Rock
menuStyle: drilldown
icon: images/rock.png
sublabel: Rock API docs
pages:
- page: openapi/rock.page.yaml/*
- group: Paper
menuStyle: drilldown
icon: images/paper.png
sublabel: Paper API docs
pages:
- page: openapi/paper.page.yaml/*
- group: Scissors
menuStyle: drilldown
icon: images/scissors.png
sublabel: Scissors API docs
pages:
- page: openapi/scissors.page.yaml
```
:::note Pagination
We've paginated the rock, paper, and scissors APIs differently as well.
:::
12 changes: 12 additions & 0 deletions drilldown/paper.page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: reference-docs
definitionId: paper
settings:
pagination: section
generateCodeSamples:
languages:
- lang: curl
- lang: JavaScript
- lang: Node.js
- lang: Python
- lang: C#
- lang: Java
10 changes: 10 additions & 0 deletions drilldown/rock.page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type: reference-docs
definitionId: rock
settings:
pagination: none
generateCodeSamples:
languages:
- lang: curl
- lang: Go
- lang: PHP
- lang: Ruby
12 changes: 12 additions & 0 deletions drilldown/scissors.page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: reference-docs
definitionId: scissors
settings:
pagination: item
generateCodeSamples:
languages:
- lang: curl
- lang: JavaScript
- lang: Node.js
- lang: Python
- lang: C#
- lang: Java
5 changes: 2 additions & 3 deletions openapi/paper.page.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
type: redoc
type: reference-docs
definitionId: paper
showInfo: true
expand: true
settings:
pagination: section
generateCodeSamples:
languages:
- lang: curl
Expand Down
13 changes: 5 additions & 8 deletions openapi/rock.page.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
type: redoc
type: reference-docs
definitionId: rock
showInfo: true
expand: true
settings:
pagination: none
generateCodeSamples:
languages:
- lang: curl
- lang: JavaScript
- lang: Node.js
- lang: Python
- lang: C#
- lang: Java
- lang: Go
- lang: PHP
- lang: Ruby
5 changes: 2 additions & 3 deletions openapi/scissors.page.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
type: redoc
type: reference-docs
definitionId: scissors
showInfo: true
expand: true
settings:
pagination: item
generateCodeSamples:
languages:
- lang: curl
Expand Down
29 changes: 29 additions & 0 deletions separated/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Separate sidebars

This makes separate sidebars (all within a single `sidebars.yaml` file).

Notice we use the `/*` to eliminate one grouping level in the scissors and rock APIs.
You will visually see the difference between those and the paper API.

```yaml
## different sidebars
rock:
- page: separated/rock-quickstart.md
- page: separated/rock.page.yaml/*
paper:
- page: separated/paper.page.yaml
scissors:
- page: separated/scissors.page.yaml/*

```

Use these links to visit those APIs:

- [Rock](./rock-quickstart.md)
- [Paper](./paper.page.yaml)
- [Scissors](./scissors.page.yaml)


:::note Pagination
We've paginated the rock, paper, and scissors APIs differently as well.
:::
12 changes: 12 additions & 0 deletions separated/paper.page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: reference-docs
definitionId: paper
settings:
pagination: section
generateCodeSamples:
languages:
- lang: curl
- lang: JavaScript
- lang: Node.js
- lang: Python
- lang: C#
- lang: Java
3 changes: 3 additions & 0 deletions separated/rock-quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Rock Quickstart

This is a quickstart for the Rock API.
10 changes: 10 additions & 0 deletions separated/rock.page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type: reference-docs
definitionId: rock
settings:
pagination: none
generateCodeSamples:
languages:
- lang: curl
- lang: Go
- lang: PHP
- lang: Ruby
12 changes: 12 additions & 0 deletions separated/scissors.page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: reference-docs
definitionId: scissors
settings:
pagination: item
generateCodeSamples:
languages:
- lang: curl
- lang: JavaScript
- lang: Node.js
- lang: Python
- lang: C#
- lang: Java
35 changes: 22 additions & 13 deletions sidebars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,37 @@ alternative:
label: Alternative sidebar example

## different sidebars
# rock:
# - page: openapi/rock.page.yaml
# paper:
# - page: openapi/paper.page.yaml
# scissors:
# - page: openapi/scissors.page.yaml/*
rock:
- page: separated/rock-quickstart.md
- page: separated/rock.page.yaml/*
paper:
- page: separated/paper.page.yaml
scissors:
- page: separated/scissors.page.yaml/*

# unified-sidebar:
# - page: openapi/rock.page.yaml
# - page: openapi/paper.page.yaml
# - page: openapi/scissors.page.yaml
combined:
- page: combined/index.md
- page: combined/rock.page.yaml
- page: combined/paper.page.yaml
- page: combined/scissors.page.yaml

drilldown-style:
- page: drilldown/index.md
- group: Rock
menuStyle: drilldown
icon: images/rock.png
sublabel: Rock API docs
pages:
- page: openapi/rock.page.yaml/*
- page: drilldown/rock.page.yaml/*
- group: Paper
menuStyle: drilldown
icon: images/paper.png
sublabel: Paper API docs
pages:
- page: openapi/paper.page.yaml/*
- page: drilldown/paper.page.yaml/*
- group: Scissors
menuStyle: drilldown
icon: images/scissors.png
sublabel: Scissors API docs
pages:
- page: openapi/scissors.page.yaml/*
- page: drilldown/scissors.page.yaml
9 changes: 9 additions & 0 deletions siteConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ nav:
- label: Training exercises
page: developer-portal/index.md

- label: Drilldown sidebars
page: drilldown/index.md

- label: Combined sidebars
page: combined/index.md

- label: Separated sidebars
page: separated/index.md

- label: External docs
icon: ./images/redocly-icon-white.png
href: https://redoc.ly/docs/developer-portal/introduction/
Expand Down

0 comments on commit 9c55073

Please sign in to comment.