diff --git a/README.md b/README.md index dcccab2..d46a69b 100644 --- a/README.md +++ b/README.md @@ -317,6 +317,7 @@ available: | `template` | `str \| none` = `none` | Template to use for this page. Relative to `templates/`, `.html` extension optional. | | `post` | `bool \| none` = `none` | Whether this page is a **post**. `true`/`false` is _absolute_. Leave it unset for automatic detection. | | `draft` | `bool` = `false` | Whether this page is a draft. See [drafts](#drafts) for more. | +| `ignore` | `bool` = `false` | Whether this page should be ignored in _both_ `final` and `draft` contexts. | | `math` | `bool` = `true` | Whether the LaTeX extension should be enabled for this page. | **Note**: you can specify the date in any format that can be parsed by diff --git a/src/zona/builder.py b/src/zona/builder.py index a04b2eb..446f07d 100644 --- a/src/zona/builder.py +++ b/src/zona/builder.py @@ -48,14 +48,12 @@ 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}.") item.metadata, item.content = parse_metadata(path) - if ( + if item.metadata.ignore or ( item.metadata.draft and not self.config.build.include_drafts ): @@ -71,13 +69,11 @@ 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 @@ -89,9 +85,7 @@ 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 @@ -117,9 +111,7 @@ 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(): diff --git a/src/zona/metadata.py b/src/zona/metadata.py index b079266..0cd6a8c 100644 --- a/src/zona/metadata.py +++ b/src/zona/metadata.py @@ -24,6 +24,7 @@ class Metadata: template: str | None = None post: bool | None = None draft: bool = False + ignore: bool = False math: bool = True