Skip to content

Commit b7563b3

Browse files
authored
doc: correct version redirects where possible (#1411)
* doc: correct version redirects where possible * ci: use nodejs 22.x
1 parent e192637 commit b7563b3

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

Diff for: .github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ jobs:
88

99
steps:
1010
- uses: actions/checkout@v4
11+
- uses: actions/setup-node@v4
12+
with:
13+
node-version: 22.x
1114
- uses: ruby/setup-ruby@v1
1215
with:
1316
ruby-version: 2.7

Diff for: .github/workflows/deploy.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 22.x
2023
- uses: ruby/setup-ruby@v1
2124
with:
2225
ruby-version: 2.7

Diff for: tools/bin/gen_pages_dict.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const LATEST_ALIAS_URI = '/latest/';
4040
function pathToURI (filePath, rootPath) {
4141
return filePath
4242
.replace(new RegExp('^' + rootPath), '')
43-
.replace(/\\.md$/, '.html');
43+
.replace(/\.md$/, '.html');
4444
}
4545

4646
function pagesFromRedirects (redirects, languages) {
@@ -88,7 +88,6 @@ function main () {
8888
// add entries for all Markdown files in the site root
8989
const allMarkdownFiles = path.join(siteRootPath, '**/*.md');
9090
fs.glob(allMarkdownFiles, function (error, filePaths) {
91-
console.log(filePaths);
9291
if (error) throw error;
9392

9493
for (let i = 0; i < filePaths.length; i++) {

Diff for: www/_layouts/docs.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
{% assign MY_ENTRY = page.url | replace: VERSION_ROOT,"" %}
1919
{% assign my_entry_parts = MY_ENTRY | split: "/" %}
2020

21+
{% assign page_url = "/" | append: page.path | replace: ".md", ".html" %}
22+
2123
{% comment %}
2224
PATH_TO_ROOT: path from here to version root, replacing all parts except the last one with '../'
2325
NOTE:
@@ -152,7 +154,7 @@
152154
layouts change from version to version
153155
{% endcomment %}
154156
{% capture other_version_root %}/docs/{{ page.language }}/{{ other_version_string }}/{% endcapture %}
155-
{% assign other_version_url = page.url | replace:VERSION_ROOT,other_version_root %}
157+
{% assign other_version_url = page_url | replace:VERSION_ROOT,other_version_root %}
156158

157159
{% unless ALL_PAGES contains other_version_url %}
158160
{% assign other_version_url = other_version_root %}
@@ -177,7 +179,7 @@
177179
Get URL for this page in the latest version
178180
{% endcomment %}
179181
{% capture latest_root %}/docs/{{ page.language }}/latest/{% endcapture %}
180-
{% assign latest_url = page.url | replace:VERSION_ROOT,latest_root %}
182+
{% assign latest_url = page_url | replace:VERSION_ROOT,latest_root %}
181183

182184
{% comment %}
183185
If this page doesn't exist, just use root

0 commit comments

Comments
 (0)