Skip to content

Commit a2a2da6

Browse files
authored
Merge pull request #81 from camriddell/case-insensitive-redirect
Fix case insensitive redirects
2 parents 1f4d34a + 2499c28 commit a2a2da6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/caseinsensitive_redirects.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ def generate_case_combinations(name):
3737
repo_root = Path(__file__).parents[1]
3838

3939
for path in repo_root.glob('_materials/*.md'):
40+
path_parent = path.relative_to(repo_root).parent
4041
with open(path) as f:
4142
metadata, f = parse_yaml_header(f)
4243
metadata.setdefault('redirect_from', [])
4344
metadata['redirect_from'] += [
44-
n for n in generate_case_combinations(path.stem)
45+
f'/{path_parent / path.with_name(n).stem}'
46+
for n in generate_case_combinations(path.stem)
4547
if n != path.stem
4648
]
4749
body = f.read()

0 commit comments

Comments
 (0)