Fixed ordering for next/previous
This commit is contained in:
parent
e0bee5292d
commit
9afbb737c0
@ -49,4 +49,7 @@ sites:
|
||||
- '*.md'
|
||||
addons:
|
||||
- rss
|
||||
|
||||
# TODO: add Jimoire Laboratoire
|
||||
# TODO: add newsletter
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -208,7 +208,7 @@ img.rss-icon{
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
span img.rss-icon{
|
||||
a > img.rss-icon{
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,6 @@
|
||||
<h2>Post History</h2>
|
||||
{content}
|
||||
<br /><hr /><br />
|
||||
<p>Last Updated: {globalvars.today}<span>{templates.components.rss_icon}</span></p>
|
||||
<p>Last Updated: {globalvars.today}{templates.components.rss_icon}</p>
|
||||
</article>
|
||||
<script src="/assets/js/blog_archive_query.js"></script>
|
||||
@ -13,7 +13,8 @@
|
||||
<br /><hr /><br />
|
||||
<p>
|
||||
<a href="{previous_article.path}" title="{previous_article.metadata.title}" data="{previous_article.path}" class="previous-article-link">< Previous</a>
|
||||
<!-- This non-breaking space prevents the RSS icon from getting weird when previous-article-link is hidden. -->
|
||||
<a href="{next_article.path}" title="{next_article.metadata.title}" data="{next_article.path}" class="next-article-link">Next ></a>
|
||||
</p>
|
||||
<p>Tags: {blog_tags}<span>{templates.components.rss_icon}</span></p>
|
||||
<p>Tags: {blog_tags}{templates.components.rss_icon}</p>
|
||||
</article>
|
||||
Loading…
x
Reference in New Issue
Block a user