[Bug] globalMetadata overwrites the pdf setting in toc.yml
Describe the bug
In my docfx.json I set "pdf": true in the globalMetadata because I want to generate pdfs for all my doc pages. By default, this also includes the toc.yml in the root, which I don't need. To prevent this behavior, I set pdf: false in the toc.yml. Despite this, the pdf was still generated and looking at the generated toc.json, "pdf" was set to true. This behavior is inconsistent with the documentation (https://dotnet.github.io/docfx/docs/pdf.html) which states that pdf can be configured in toc.yml, which I would expect to take precedence over globalMetadata.
Turning off pdf in fileMetadata still works though, so it's not really that big of a deal
To Reproduce Steps to reproduce the behavior:
- In docfx.json, set
build.globalMetadata.pdftotrue - In toc.yml, set
pdftofalse - run docfx docfx.json
- The pdf value in the generated toc.json will be
trueand the pdf for toc.yml will be generated
Expected behavior The value from toc.yml should be used instead of the value from globalMetadata.
Context (please complete the following information):
- OS: Windows
- Docfx version: 2.78.5-preview.72
Additional context Add any other context about the problem here.
I set "pdf": false in globalMetadata in docfx.json and then pdf: true in a TOC.yml file. (The articles of that TOC form a self-contained set that does not have hyperlinks pointing elsewhere.) That override works fine; I get only one PDF. I am using the 2.78.5 release though, rather than a preview.
So it surprises me if the opposite configuration (with true in globalMetadata and false in TOC.yml) really doesn't work. Is the root TOC a special case?
I'm worried that matching YAML header behavior here would be a breaking change, since fileMetadata would no longer override values in toc.yml. I'd prefer keeping fileMetadata > toc.yml > globalMetadata, but that would be inconsistent with YAML headers. What do you think? Would you expect fileMetadata to override the TOC value in your setup?
I aggree that fileMetadata > toc.yml > globalMetadata is probably best for compatibility and the docs make a good point in favor of this as well, to allow auto-generated toc.yml files to be overruled.
Thanks for addressing the issue.