Skip to content

Commit 6ad09d2

Browse files
committed
Support switcher in org level sites
1 parent b9acf3b commit 6ad09d2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
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}")

0 commit comments

Comments
 (0)