Skip to content

doc: correct version redirects where possible #1411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
Expand Down
3 changes: 1 addition & 2 deletions tools/bin/gen_pages_dict.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const LATEST_ALIAS_URI = '/latest/';
function pathToURI (filePath, rootPath) {
return filePath
.replace(new RegExp('^' + rootPath), '')
.replace(/\\.md$/, '.html');
.replace(/\.md$/, '.html');
}

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

for (let i = 0; i < filePaths.length; i++) {
Expand Down
6 changes: 4 additions & 2 deletions www/_layouts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
{% assign MY_ENTRY = page.url | replace: VERSION_ROOT,"" %}
{% assign my_entry_parts = MY_ENTRY | split: "/" %}

{% assign page_url = "/" | append: page.path | replace: ".md", ".html" %}

{% comment %}
PATH_TO_ROOT: path from here to version root, replacing all parts except the last one with '../'
NOTE:
Expand Down Expand Up @@ -152,7 +154,7 @@
layouts change from version to version
{% endcomment %}
{% capture other_version_root %}/docs/{{ page.language }}/{{ other_version_string }}/{% endcapture %}
{% assign other_version_url = page.url | replace:VERSION_ROOT,other_version_root %}
{% assign other_version_url = page_url | replace:VERSION_ROOT,other_version_root %}

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

{% comment %}
If this page doesn't exist, just use root
Expand Down