server now includes drafts by default
This commit is contained in:
parent
bdd7558999
commit
8d17572d12
3 changed files with 15 additions and 9 deletions
10
README.md
10
README.md
|
@ -37,6 +37,7 @@ For an example of a website built with zona, please see
|
|||
- [Markdown Footer](#markdown-footer)
|
||||
- [Internal Link Resolution](#internal-link-resolution)
|
||||
- [Syntax Highlighting](#syntax-highlighting)
|
||||
- [Markdown Extensions](#markdown-extensions)
|
||||
- [Image Labels](#image-labels)
|
||||
- [Frontmatter](#frontmatter)
|
||||
- [Post List](#post-list)
|
||||
|
@ -125,9 +126,12 @@ support from the browser — this is why the feature is optional.
|
|||
To start a preview server, use `zona serve`. You can specify the root
|
||||
directory as its first argument. Use the `--host` to specify a host name
|
||||
(`localhost` by default) and `--port/-p` to specify a port (default:
|
||||
`8000`). The `--output/-o` and `--draft/-d` options from `zona build` are
|
||||
also supported. Finally, the `--no-live-reload/-n` disables the live
|
||||
browser reloading. _Automatic site rebuilds are not disabled._
|
||||
`8000`). The `--no-live-reload/-n` disables the live browser reloading
|
||||
(_automatic site rebuilds are not disabled_).
|
||||
|
||||
Drafts are enabled by default in live preview. Use `--final/-f` to disable
|
||||
them. By default, the build outputs to a temporary directory. Use
|
||||
`-o/--output` to override this.
|
||||
|
||||
**Note**: if the live preview isn't working as expected, try restarting
|
||||
the server. If you change the configuration or any templates, the server
|
||||
|
|
|
@ -91,9 +91,9 @@ def serve(
|
|||
help="Location to write built website. Temporary directory by default.",
|
||||
),
|
||||
] = None,
|
||||
draft: Annotated[
|
||||
final: Annotated[
|
||||
bool,
|
||||
typer.Option("--draft", "-d", help="Include drafts."),
|
||||
typer.Option("--final", "-f", help="Don't include drafts."),
|
||||
] = False,
|
||||
no_live_reload: Annotated[
|
||||
bool,
|
||||
|
@ -111,12 +111,14 @@ def serve(
|
|||
|
||||
Optionally specify the ROOT and OUTPUT directories.
|
||||
"""
|
||||
if draft:
|
||||
print("Option override: including drafts.")
|
||||
if final:
|
||||
print("Preview without drafts.")
|
||||
else:
|
||||
print("Preview with drafts.")
|
||||
server.serve(
|
||||
root=root,
|
||||
output=output,
|
||||
draft=draft,
|
||||
draft=not final,
|
||||
host=host,
|
||||
port=port,
|
||||
live_reload=not no_live_reload,
|
||||
|
|
|
@ -168,7 +168,7 @@ class ZonaReloadHandler(FileSystemEventHandler):
|
|||
def serve(
|
||||
root: Path | None = None,
|
||||
output: Path | None = None,
|
||||
draft: bool = False,
|
||||
draft: bool = True,
|
||||
host: str = "localhost",
|
||||
port: int = 8000,
|
||||
live_reload: bool = True,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue