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)
|
- [Markdown Footer](#markdown-footer)
|
||||||
- [Internal Link Resolution](#internal-link-resolution)
|
- [Internal Link Resolution](#internal-link-resolution)
|
||||||
- [Syntax Highlighting](#syntax-highlighting)
|
- [Syntax Highlighting](#syntax-highlighting)
|
||||||
|
- [Markdown Extensions](#markdown-extensions)
|
||||||
- [Image Labels](#image-labels)
|
- [Image Labels](#image-labels)
|
||||||
- [Frontmatter](#frontmatter)
|
- [Frontmatter](#frontmatter)
|
||||||
- [Post List](#post-list)
|
- [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
|
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
|
directory as its first argument. Use the `--host` to specify a host name
|
||||||
(`localhost` by default) and `--port/-p` to specify a port (default:
|
(`localhost` by default) and `--port/-p` to specify a port (default:
|
||||||
`8000`). The `--output/-o` and `--draft/-d` options from `zona build` are
|
`8000`). The `--no-live-reload/-n` disables the live browser reloading
|
||||||
also supported. Finally, the `--no-live-reload/-n` disables the live
|
(_automatic site rebuilds are not disabled_).
|
||||||
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
|
**Note**: if the live preview isn't working as expected, try restarting
|
||||||
the server. If you change the configuration or any templates, the server
|
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.",
|
help="Location to write built website. Temporary directory by default.",
|
||||||
),
|
),
|
||||||
] = None,
|
] = None,
|
||||||
draft: Annotated[
|
final: Annotated[
|
||||||
bool,
|
bool,
|
||||||
typer.Option("--draft", "-d", help="Include drafts."),
|
typer.Option("--final", "-f", help="Don't include drafts."),
|
||||||
] = False,
|
] = False,
|
||||||
no_live_reload: Annotated[
|
no_live_reload: Annotated[
|
||||||
bool,
|
bool,
|
||||||
|
@ -111,12 +111,14 @@ def serve(
|
||||||
|
|
||||||
Optionally specify the ROOT and OUTPUT directories.
|
Optionally specify the ROOT and OUTPUT directories.
|
||||||
"""
|
"""
|
||||||
if draft:
|
if final:
|
||||||
print("Option override: including drafts.")
|
print("Preview without drafts.")
|
||||||
|
else:
|
||||||
|
print("Preview with drafts.")
|
||||||
server.serve(
|
server.serve(
|
||||||
root=root,
|
root=root,
|
||||||
output=output,
|
output=output,
|
||||||
draft=draft,
|
draft=not final,
|
||||||
host=host,
|
host=host,
|
||||||
port=port,
|
port=port,
|
||||||
live_reload=not no_live_reload,
|
live_reload=not no_live_reload,
|
||||||
|
|
|
@ -168,7 +168,7 @@ class ZonaReloadHandler(FileSystemEventHandler):
|
||||||
def serve(
|
def serve(
|
||||||
root: Path | None = None,
|
root: Path | None = None,
|
||||||
output: Path | None = None,
|
output: Path | None = None,
|
||||||
draft: bool = False,
|
draft: bool = True,
|
||||||
host: str = "localhost",
|
host: str = "localhost",
|
||||||
port: int = 8000,
|
port: int = 8000,
|
||||||
live_reload: bool = True,
|
live_reload: bool = True,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue