postdoc create page


Creates a Markdown page and a page test for it: a Nightwatch page object that postdoc test runs with nightwatch-plugin-postdoc. The page goes into the content directory, and the page test into pages in the tests directory, at the same relative path.

Options:

  • --name <url> - the URL or path of the new page, such as /guide/faq. It can't lead out of the content directory. Without this option, PostDoc asks for it, or, when there's no terminal to ask in, stops with an error.
  • --draft - starts the page as a draft, which the dev server shows and builds leave out until you remove draft: true from its front matter. A draft gets no page test, as there's no page in the build for it to test.

The command exits with 1 when it can't create the page, such as when the page or its page test exists already.

Example

sh
npx postdoc create page --name /guide/faq