From 0e948e7f555582a21ef350b9ce1578af854795df Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Tue, 15 Apr 2025 12:19:45 +0200 Subject: [PATCH] feat: small refactoring for building of urls --- stsg/build.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stsg/build.py b/stsg/build.py index 6fa8d8d..4615eb7 100644 --- a/stsg/build.py +++ b/stsg/build.py @@ -48,8 +48,9 @@ class ArticleTranslation: if self.file.suffix == ".md": self.article_content = markdown.markdown(self.article_content) - self.url = "/" + self.language_code + self.article_overview.url - self.dist_path = Path(DIST_DIRECTORY, self.url.strip("/")) + self.location_in_tree = [self.language_code, *self.article_overview.location_in_tree] + self.url = "/" + "/".join(self.location_in_tree) + self.dist_path = Path(DIST_DIRECTORY, *self.location_in_tree) _language_info = DEFAULT_LANGUAGE parsed_language_code = self.language_code.lower().replace("-", "_") @@ -97,7 +98,6 @@ class ArticleOverview: self.location_in_tree: List[str] = location_in_tree or [] self.location_in_tree.append(self.slug) - self.url = "/" + "/".join(self.location_in_tree) self.dist_path = Path(DIST_DIRECTORY, *self.location_in_tree)