From 9afbb737c0170a43d13f0e0042765d72a72f7fc5 Mon Sep 17 00:00:00 2001 From: Jim Shepich III Date: Fri, 6 Feb 2026 10:09:18 -0500 Subject: [PATCH] Fixed ordering for next/previous --- config.yaml | 3 +++ jimsite/articles.py | 9 ++++++--- jimsite/assets.py | 4 ++-- jimsite/common.py | 7 ++----- site/assets/css/theme.css | 2 +- site/templates/components/blog_archive.html | 2 +- site/templates/components/blog_article.html | 3 ++- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/config.yaml b/config.yaml index 6767839..67db17b 100644 --- a/config.yaml +++ b/config.yaml @@ -49,4 +49,7 @@ sites: - '*.md' addons: - rss + + # TODO: add Jimoire Laboratoire + # TODO: add newsletter \ No newline at end of file diff --git a/jimsite/articles.py b/jimsite/articles.py index 16712c1..8133211 100644 --- a/jimsite/articles.py +++ b/jimsite/articles.py @@ -107,12 +107,15 @@ def build_articles( '''Generates HTML files for all of a given site's Markdown articles by interpolating the contents and metadata into the HTML templates.''' + # Sort the articles in order of ascending date. + sorted_articles = sorted([*index.values()], key = lambda a: a.metadata.date) + # Include the previous and next articles (if available) in the iteration # in case the article template wants to link to them. for previous_article, article, next_article in zip( - ([None] + [*index.values()][:-1]), - index.values(), - ([*index.values()][1:] + [None]) + ([None] + sorted_articles[:-1]), + sorted_articles, + (sorted_articles[1:] + [None]) ): # Create a dummy to be used for the first article's "previous" and the last # article's "next" to avoid errors if trying to access into None. diff --git a/jimsite/assets.py b/jimsite/assets.py index 0522914..13aec9c 100644 --- a/jimsite/assets.py +++ b/jimsite/assets.py @@ -21,8 +21,8 @@ def pull_git_repo(repo: GitRepo, build_cache: str) -> None: # Download all LFS files. if repo.lfs: - run('git -C {build_cache} lfs fetch --all') - run('git -C {build_cache} lfs pull') + run(f'git -C {build_cache} lfs fetch --all') + run(f'git -C {build_cache} lfs pull') return None diff --git a/jimsite/common.py b/jimsite/common.py index 475a2d2..f220627 100644 --- a/jimsite/common.py +++ b/jimsite/common.py @@ -11,7 +11,7 @@ from typing import Union logger = logging.getLogger(__name__) -def run(cmd: Union[list,str], log_errors = True, debug = True) -> tuple: +def run(cmd: Union[list,str]) -> tuple: if isinstance(cmd, str): cmd = cmd.split(' ') @@ -21,10 +21,7 @@ def run(cmd: Union[list,str], log_errors = True, debug = True) -> tuple: res.stderr = res.stderr.decode().strip() res.cmd = cmd - if debug: - logger.debug(res) - - if log_errors and res.stderr: + if res.stderr: logger.exception(res.stderr) return res diff --git a/site/assets/css/theme.css b/site/assets/css/theme.css index 2f77bed..191203d 100644 --- a/site/assets/css/theme.css +++ b/site/assets/css/theme.css @@ -208,7 +208,7 @@ img.rss-icon{ vertical-align: middle; } -span img.rss-icon{ +a > img.rss-icon{ float: right; } diff --git a/site/templates/components/blog_archive.html b/site/templates/components/blog_archive.html index 2315645..8c849d4 100644 --- a/site/templates/components/blog_archive.html +++ b/site/templates/components/blog_archive.html @@ -7,6 +7,6 @@

Post History

{content}


-

Last Updated: {globalvars.today}{templates.components.rss_icon}

+

Last Updated: {globalvars.today}{templates.components.rss_icon}

\ No newline at end of file diff --git a/site/templates/components/blog_article.html b/site/templates/components/blog_article.html index 48a7cd1..381a27c 100644 --- a/site/templates/components/blog_article.html +++ b/site/templates/components/blog_article.html @@ -13,7 +13,8 @@


+  

-

Tags: {blog_tags}{templates.components.rss_icon}

+

Tags: {blog_tags}{templates.components.rss_icon}

\ No newline at end of file