Cannot quarto publish when _quarto.yml has output-dir configured

I'm trying to understand how to publish a .qmd to quarto.pub when the _quarto.yaml has output-dir set.

My _quarto.yaml has

project:
  title: "foo"
   output-dir: _output

I have a single .qmd that I want to publish to Quarto.pub. I'm on Windows OS 10. When I build (render project), everything works as expected. The output goes into the _output subdirectory.

When I then try to publish to quarto.pub using the following command, in the terminal tab of the IDE:

quarto publish quarto-pub test.qmd

I get the following error:

Error = ERROR: NotFound: The system cannot find the file specified. (os error 2).

So, as long as I don't define output-dir in the _quarto.yaml everything works fine. Ideally, I'd like to have the .qmd files in one subdirectory and the output in another, both off of the project root.

Would love to hear some suggestions. My question is whether there is a way to tell the quarto publish quarto-pub command where the _output directory is located?

I think you read https://quarto.org/docs/publishing/quarto-pub.html .
Did you use _publish.yml as e.g. specified in https://quarto.org/docs/publishing/quarto-pub.html#publish.yml ?

Thanks for the suggestion @HanOostdijk . I've been staring at the Quarto docs for a while and just realized that my question should have been more carefully expressed to query about the configurability of a Quarto project, rather than the specifics of publishing to Quarto.pub. But, so it goes with reading documentation. Anyway, I appreciate the suggestion. (short answer in tl;dr)

So, to restate/clarify/document...

This question arose because I am customizing a subdirectory for executable scripts in ./scripts . And then trying to quarto publish a single rendered script from within that subdir, via the Terminal command:

quarto publish quarto-pub scripts/my-special-script.qmd

In short, this doesn't work with a single .qmd script located within a subdirectory when the output-dir is also identified in the _quarto.yml. But if I remove the requirement of publishing to Quarto.pub, then the I can render my project and tackle publishing differently (e.g. GitHub Actions or Netlify)

Nonethless, I now realize that my goal was not reflected very well in my initial question. Hopefully the following might help another... I want to know whether Quarto projects can be customized with executable scripts in one subdirectory, and output scripts in another. )

The answer, from the project options page, is to set the project type to default in _quarto.yaml as follows:

project:
  type: default
  output-dir: output

In other words, in this case, do not start a quarto project as either a book or a website. Because those project types, while very convenient for publishing to Quarto-pub, do not allow the customizations I need for file-organization. Customizations imposed by spec, elsehwere.

(The problem with setting the project type to book or website is that the initial scripts must be in the quarto project root -- even while it's possible to render other scripts from subdirectories. This is fine, but the reproducibility practice, which I must follow, prefers different assumptions. Meanwhile, publishing to Quarto.pub is not my necessary end results. Therefore book and website project types rendered my file organizational requirements inoperable.)

tl;dr my question didn't express my problem accurately. Setting the Quarto project type to default in _quarto.yaml solves my issue. Quarto.pub is very cool and convenient. In this case, I need more flexibility than type = book or type = website allow. It would be nice to have the ability to identify the project out-dir from an argument in the quarto publish quarto-pub terminal command.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.