diff --git a/README.md b/README.md
index d46a69b..bd7eb9b 100644
--- a/README.md
+++ b/README.md
@@ -172,8 +172,8 @@ public/
The **root** of the zona **project** _must_ contain the configuration file,
`config.yml`, and a directory called `content`. A directory called `templates`
-is optional, and prioritized if it exists. `public` is the built site output —
-it's recommended to add this path to your `.gitignore`.
+is optional, and merged with the defaults if it exists. `public` is the built
+site output — it's recommended to add this path to your `.gitignore`.
The `content` directory is the **root of the website**. Think of it as the
**content root**. For example, suppose your website is hosted at `example.com`.
@@ -191,9 +191,10 @@ site using the `post_list` template.
### Templates
The `templates` directory may contain any `jinja2` template files. You may
-modify the existing templates or create your own. To apply a certain template to
-a page, set the `template` option in its [frontmatter](#frontmatter). The
-following public variables are made available to the template engine:
+modify the existing templates or create your own. Your templates are merged with
+the packaged defaults. To apply a certain template to a page, set the `template`
+option in its [frontmatter](#frontmatter). The following public variables are
+made available to the template engine:
| Name | Description |
| ---------- | ------------------------------------------------------ |
diff --git a/src/zona/builder.py b/src/zona/builder.py
index 446f07d..5c8af6b 100644
--- a/src/zona/builder.py
+++ b/src/zona/builder.py
@@ -30,6 +30,7 @@ class ZonaBuilder:
self.config.build.include_drafts = True
self.items: list[Item] = []
self.item_map: dict[Path, Item] = {}
+ self.fresh: bool = True
def _discover(self):
layout = self.layout
@@ -48,7 +49,9 @@ class ZonaBuilder:
destination=destination,
url=str(destination.relative_to(layout.output)),
)
- if path.name.endswith(".md") and not path.is_relative_to(
+ if path.name.endswith(
+ ".md"
+ ) and not path.is_relative_to(
layout.root / "content" / "static"
):
logger.debug(f"Parsing {path.name}.")
@@ -69,11 +72,13 @@ class ZonaBuilder:
item.copy = False
name = destination.stem
if name == "index":
- item.destination = item.destination.with_suffix(
- ".html"
+ item.destination = (
+ item.destination.with_suffix(".html")
)
else:
- relative = path.relative_to(base).with_suffix("")
+ relative = path.relative_to(base).with_suffix(
+ ""
+ )
name = relative.stem
item.destination = (
layout.output
@@ -85,7 +90,9 @@ class ZonaBuilder:
layout.output
)
item.url = (
- "" if rel_url == Path(".") else rel_url.as_posix()
+ ""
+ if rel_url == Path(".")
+ else rel_url.as_posix()
)
items.append(item)
self.items = items
@@ -99,6 +106,13 @@ class ZonaBuilder:
else date.min,
reverse=True,
)
+ posts = len(post_list)
+ for i, item in enumerate(post_list):
+ prev = post_list[i - 1] if i > 0 else None
+ next = post_list[i + 1] if i < posts - 2 else None
+ item.previous = prev
+ item.next = next
+
templater = Templater(
config=self.config,
template_dir=self.layout.templates,
@@ -111,7 +125,9 @@ class ZonaBuilder:
# write code highlighting stylesheet
if self.config.markdown.syntax_highlighting.enabled:
pygments_style = zmd.get_style_defs(self.config)
- pygments_path = self.layout.output / "static" / "pygments.css"
+ pygments_path = (
+ self.layout.output / "static" / "pygments.css"
+ )
util.ensure_parents(pygments_path)
pygments_path.write_text(pygments_style)
for item in self.item_map.values():
@@ -152,7 +168,10 @@ class ZonaBuilder:
child.unlink()
elif child.is_dir():
shutil.rmtree(child)
+ if not self.fresh:
+ self.layout = self.layout.refresh()
logger.debug("Discovering...")
self._discover()
logger.debug("Building...")
self._build()
+ self.fresh = False
diff --git a/src/zona/data/content/static/style.css b/src/zona/data/content/static/style.css
index d2cacf0..f02717e 100644
--- a/src/zona/data/content/static/style.css
+++ b/src/zona/data/content/static/style.css
@@ -31,6 +31,18 @@ header {
text-transform: lowercase;
}
+.post-nav {
+ font-family: monospace;
+}
+
+.post-nav .symbol {
+ color: var(--main-bullet-color);
+}
+
+.post-nav a {
+ margin: 0 2px;
+}
+
.site-logo {
color: inherit;
font-weight: bold;
diff --git a/src/zona/data/templates/page.html b/src/zona/data/templates/page.html
index fd3cdb4..0c22f8b 100644
--- a/src/zona/data/templates/page.html
+++ b/src/zona/data/templates/page.html
@@ -1,18 +1,12 @@
-{% extends "base.html" %} {% block content %}
-
-{% if metadata.show_title %}
-{% include "title.html" %}
-{% if metadata.date %}
+{% extends "base.html" %} {% block content %} {% if metadata.show_title %} {%
+include "title.html" %} {% if metadata.date %}