feat: small refactoring for building of urls

This commit is contained in:
Hazel 2025-04-15 12:19:45 +02:00
parent 79c95a9ddb
commit 0e948e7f55

View File

@ -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)