Skip to content

Commit 8c0be2c

Browse files
committed
doc: correct version redirects where possible
1 parent aba7056 commit 8c0be2c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

tools/bin/gen_pages_dict.js

Lines changed: 1 addition & 2 deletions
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++) {

www/_layouts/docs.html

Lines changed: 4 additions & 2 deletions
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)