Browse Source

More correct logic on neighborhood

master
David Larlet 4 years ago
parent
commit
b2cc651bdd
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      site.py

+ 3
- 3
site.py View File

"""Build the agregations from fragments.""" """Build the agregations from fragments."""
root_path = DAVID / "2020" root_path = DAVID / "2020"
for previous, page, next_ in neighborhood( for previous, page, next_ in neighborhood(
Page.all(source=root_path, only_published=False),
last={"url": "/david/stream/", "title": "Streams 2009-2019"},
reversed(Page.all(source=root_path, only_published=False)),
first={"url": "/david/stream/", "title": "Streams 2009-2019"},
): ):
template = environment.get_template("article_2020.html") template = environment.get_template("article_2020.html")
content = template.render(page=page, next=previous, prev=next_,)
content = template.render(page=page, prev=previous, next=next_,)
target_path = Path(page.url[1:]) target_path = Path(page.url[1:])
target_path.mkdir(parents=True, exist_ok=True) target_path.mkdir(parents=True, exist_ok=True)
open(target_path / "index.html", "w").write(content) open(target_path / "index.html", "w").write(content)

Loading…
Cancel
Save