diff options
| author | Eltrac <hi@guhub.cn> | 2025-05-30 14:38:16 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-05-30 14:38:16 +0800 |
| commit | 78a005a59945f963b78e6446b62748fdb74a705d (patch) | |
| tree | 96bb46f7e81530ce968fd76388b12920155b5655 /scripts | |
| parent | 924e88af98cee7c5c81057f904ac03e72ce1895b (diff) | |
fix: occasional 404 error in link graph
Permalinks in Hugo are usually in lowercases if it's using a filename, but the link graph use un-lowered filenames for links, which caused a few problems.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/analyze_links.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/analyze_links.py b/scripts/analyze_links.py index 598f4a94..8364100e 100644 --- a/scripts/analyze_links.py +++ b/scripts/analyze_links.py @@ -75,7 +75,7 @@ def parse_frontmatter(filepath): def get_canonical_url(filepath, frontmatter): rel_path = os.path.relpath(filepath, content_dir) dirname, filename = os.path.split(rel_path) - name = os.path.splitext(filename)[0] + name = os.path.splitext(filename)[0].lower() slug = frontmatter.get("slug") or name parts = dirname.split(os.sep) return f"/{'/'.join(parts)}/{slug}/" if parts != [""] else f"/{slug}/" |
