Commit 314d35e
authored
Fix version switcher URL bug and improve docs navigation/landing page (#182)
Version switcher on the global index page produced broken URLs like
`.../index.html/1.0/PolylineAlgorithm.html`, and even when corrected
would land users on the raw API reference — a poor first-visit
experience. Introduction was also redundant as a separate guide entry.
## Changes
### `version-switcher.js`
- **URL fix**: `getSiteRoot()` treated an empty `docfx:rel` meta
attribute as a valid relative URL, causing `new URL('',
'.../index.html')` to resolve to the full page path including the
filename. Now falls back to `'./'` when the attribute is empty.
- **Better redirect from index**: Selecting a version on the global
index now navigates to `{version}/guide/getting-started.html` instead of
`{version}/PolylineAlgorithm.html`.
```js
// Before
return meta ? meta.getAttribute('content') : './';
// After — empty string is falsy, so we fall back to './'
return meta ? (meta.getAttribute('content') || './') : './';
```
### `api-reference/guide/toc.yml`
- Removed the **Introduction** entry; **Getting Started** is now the
first and default page in the versioned guide sidebar.
### `api-reference/index.md`
- Replaced the bare link list with a proper landing page: library
summary, key benefits, and a quick-start install snippet — content drawn
from `introduction.md`. The `{versions_section}` placeholder is
preserved for workflow injection.
### `publish-documentation.yml`
- Navbar `toc.yml` generation and the versions table both updated to
link to `getting-started.html` instead of the now-removed
`introduction.html`.1 parent 879b413 commit 314d35e
4 files changed
Lines changed: 29 additions & 18 deletions
File tree
- .github/workflows
- api-reference
- docs-versioning/public
- guide
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
| 1 | + | |
4 | 2 | | |
5 | 3 | | |
6 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
14 | 27 | | |
15 | 28 | | |
16 | 29 | | |
17 | 30 | | |
18 | 31 | | |
19 | | - | |
20 | 32 | | |
| 33 | + | |
0 commit comments