Skip to content

Commit 393bbc9

Browse files
authored
Fix redirects (#283)
1 parent a579e0f commit 393bbc9

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ jobs:
4848
env:
4949
BING_TOKEN: ${{ secrets.BING_TOKEN }}
5050

51-
- name: Add sitemap.xml to root directory
52-
run: mv build/html/en/sitemap.xml build/html
53-
5451
- name: Deploy documentation sphinx
5552
uses: JamesIves/[email protected]
5653
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

build.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"""
6363

6464

65-
def build_docs(language: str) -> None:
65+
def build_docs(language: str, isroot: bool) -> None:
6666
"""
6767
Build the documentation for a single language.
6868
@@ -78,7 +78,7 @@ def build_docs(language: str) -> None:
7878
"-b",
7979
"dirhtml",
8080
str(srcdir),
81-
str(outdir / language),
81+
str(outdir) if isroot else str(outdir / language),
8282
f"-Dlanguage={language}",
8383
],
8484
cwd=root,
@@ -97,14 +97,14 @@ def build_redirects(redirects: Dict[str, str], language: str) -> None:
9797
language : str
9898
The language to build the redirects for.
9999
"""
100-
101-
for source, target in redirects.items():
102-
source_path = outdir / source
103-
redirect = template.format(target.format(language))
104-
if not source_path.parent.exists():
105-
source_path.parent.mkdir(parents=True)
106-
with open(source_path, "w", encoding="utf-8") as fp:
107-
fp.write(redirect)
100+
pass
101+
# for source, target in redirects.items():
102+
# source_path = outdir / source
103+
# redirect = template.format(target.format(language))
104+
# if not source_path.parent.exists():
105+
# source_path.parent.mkdir(parents=True)
106+
# with open(source_path, "w", encoding="utf-8") as fp:
107+
# fp.write(redirect)
108108

109109

110110
def build_all(redirects: Dict[str, str], languages: List[str]) -> None:
@@ -120,7 +120,7 @@ def build_all(redirects: Dict[str, str], languages: List[str]) -> None:
120120
"""
121121

122122
for language in languages:
123-
build_docs(language)
123+
build_docs(language, language == languages[0])
124124

125125
build_redirects(redirects, languages[0])
126126

source/_templates/version-switcher.html

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,62 +48,62 @@
4848
{
4949
name: "English",
5050
version: "en",
51-
url: "../en/",
51+
url: "",
5252
},
5353
{
5454
name: "bn",
5555
version: "bn",
56-
url: "../bn/",
56+
url: "bn/",
5757
},
5858
{
5959
name: "cs",
6060
version: "cs",
61-
url: "../cs/",
61+
url: "cs/",
6262
},
6363
{
6464
name: "Deutsch",
6565
version: "de",
66-
url: "../de/",
66+
url: "de/",
6767
},
6868
{
6969
name: "Español",
7070
version: "es",
71-
url: "../es/",
71+
url: "es/",
7272
},
7373
{
7474
name: "Français",
7575
version: "fr",
76-
url: "../fr/",
76+
url: "fr/",
7777
},
7878
{
7979
name: "ja",
8080
version: "ja",
81-
url: "../ja/",
81+
url: "ja/",
8282
},
8383
{
8484
name: "Nederlands",
8585
version: "nl",
86-
url: "../nl/",
86+
url: "nl/",
8787
},
8888
{
8989
name: "pl",
9090
version: "pl",
91-
url: "../pl/",
91+
url: "pl/",
9292
},
9393
{
9494
name: "Português",
9595
version: "pt",
96-
url: "../pt/",
96+
url: "pt/",
9797
},
9898
{
9999
name: "Русский",
100100
version: "ru",
101-
url: "../ru/",
101+
url: "ru/",
102102
},
103103
{
104104
name: "简体中文",
105105
version: "zh_CN",
106-
url: "../zh_CN/",
106+
url: "zh_CN/",
107107
},
108108
];
109109
// console.log(data);
@@ -116,10 +116,13 @@
116116
const node = document.createElement("a");
117117
node.setAttribute("class", "list-group-item list-group-item-action py-1");
118118
node.textContent = `${entry.name}`;
119+
120+
119121
node.setAttribute(
120122
"href",
121-
`${indexFilePath}${entry.url}${currentFilePath}`,
123+
`https://fortran-lang.org/${entry.url}${currentFilePath}`,
122124
);
125+
123126
// on click, AJAX calls will check if the linked page exists before
124127
// trying to redirect, and if not, will redirect to the homepage
125128
// for that version of the docs.

0 commit comments

Comments
 (0)