feat: added date to values

This commit is contained in:
Hazel 2025-04-15 16:54:01 +02:00
parent ae5ba0d044
commit ddd536c958

View File

@ -84,6 +84,7 @@ class ArticleTranslation:
"article_overview_url": self.article_overview.url,
"article_slug": self.article_overview.slug,
"article_title": self.title,
"article_datetime": self.article_overview.article_written.strftime(config.formatting.datetime_format),
"article_language_name": self.language_name,
"article_language_code": self.language_code,
"article_language_flag": self.language_flag,
@ -111,7 +112,7 @@ class ArticleTranslation:
class ArticleOverview:
def __init__(self, directory: Path, location_in_tree: Optional[List[str]] = None):
def __init__(self, directory: Path, location_in_tree: Optional[List[str]] = None, is_root: bool = False):
self.directory = directory
article_config = {}
@ -173,6 +174,7 @@ class ArticleOverview:
"article_url": self.url,
"article_title": self.slug,
"article_slug": self.slug,
"article_datetime": self.article_written.strftime(config.formatting.datetime_format),
"article_overview_url": self.url,
"article_overview_cards": self.overview_cards,
}
@ -207,7 +209,7 @@ def build():
shutil.copytree(Path(config.setup.source_directory, "static"), Path(config.setup.dist_directory, "static"), dirs_exist_ok=True)
logger.info("reading page tree...")
tree = ArticleOverview(directory=Path(config.setup.source_directory, "articles"))
tree = ArticleOverview(directory=Path(config.setup.source_directory, "articles"), is_root=True)
# build article reverence values
for article_overview in ARTICLE_LAKE.values():