Skip to content

Commit 382820b

Browse files
authored
Fix docs issues with org level sites (#135)
2 parents 97e238d + 6ad09d2 commit 382820b

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.github/pages/make_switcher.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ def get_versions(ref: str, add: Optional[str]) -> List[str]:
5555

5656
def write_json(path: Path, repository: str, versions: str):
5757
org, repo_name = repository.split("/")
58+
pages_url = f"https://{org}.github.io"
59+
if repo_name != f"{org}.github.io":
60+
# Only add the repo name if it isn't the source for the org pages site
61+
pages_url += f"/{repo_name}"
5862
struct = [
59-
{"version": version, "url": f"https://{org}.github.io/{repo_name}/{version}/"}
60-
for version in versions
63+
{"version": version, "url": f"{pages_url}/{version}/"} for version in versions
6164
]
6265
text = json.dumps(struct, indent=2)
6366
print(f"JSON switcher:\n{text}")

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
# A dictionary of values to pass into the template engine’s context for all pages
143143
html_context = {
144144
"github_user": github_user,
145-
"github_repo": project,
145+
"github_repo": github_repo,
146146
"github_version": version,
147147
"doc_path": "docs",
148148
}

template/{% if sphinx %}docs{% endif %}/conf.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ html_theme_options = {
166166
# A dictionary of values to pass into the template engine’s context for all pages
167167
html_context = {
168168
"github_user": github_user,
169-
"github_repo": project,
169+
"github_repo": github_repo,
170170
"github_version": version,
171171
"doc_path": "docs",
172172
}

0 commit comments

Comments
 (0)