-
Notifications
You must be signed in to change notification settings - Fork 383
Description
Bug description
If multiple formats are specified in a _metadata.yml, all are rendered even if one attempts to override the format setup via the file-level YAML header.
The use case for me is as follows:
- in a subdirectory, I have an index file and several longer pages
- I want the pages accessible in multiple format
- but don't need the index page in all these formats, just HTML
(I am aware of the workaround by setting format-links: false
), but it seems wasteful to generate these unneeded files and the workaround may be insufficient for more complex combination of formats. I also know I could set all the formats in each file, but that seems counter to the logic of having a metadata file.)
Steps to reproduce
- new project
quarto create-project --type website
- update formats in quarto.yml
project:
type: website
website:
title: "quarto-formats"
navbar:
left:
- href: index.qmd
text: Home
- about.qmd
format:
html:
theme: cosmo
css: styles.css
toc: true
docx: default
pdf: default
index.qmd at root level stays as created by quarto:
---
title: "quarto-formats"
format:
html: default
---
This is a Quarto website.
To learn more about Quarto websites visit <https://quarto.org/docs/websites>.
- add subdirectory and metadata file
_metadata.yml in a subdirectory
format:
html: default
docx: default
- create index.qmd in the same subdirectory, leaving only HTML format set
---
title: Subdir index
format:
html: default
---
- create page.qmd in subdirectory, with no format setting in its YAML
---
title: Page in subdir
---
Expected behavior
Page-level YAML should override directory-level _metadata.yml such that if only one format is specified in file-level YAML, only that format should be rendered.
A more explicit solution (though not sure if consistent) might be to allow specific formats to be set to false
in YAML headers and in _metadata.yml.
Actual behavior
Currently:
- file-level YAML correctly overrides format settings from site-level _quarto.yml
- index.html in root correctly only has HTML format
- about.html in root has both HTML and docx
- directory-level _metadata.yml correctly overrides _quarto.yaml formats in the relevant directory
- page.html, with no format setting, has both formats
but:
- for a file in a subdirectory where the local _metadata.yml specifies multiple formats, all these formats are rendered for all files even if only one is specified in file-level YAML.
- index.html in subdirectory has both formats, even though its YAML says to only have HTML
Your environment
- IDE: Version 2023.09.0+448 (2023.09.0+448)
- OS: MacOS Sonoma 14.0 (23A344)
Quarto check output
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.1: OK
Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.3.450
Path: /Applications/quarto/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.11.5
Path: /opt/homebrew/opt/[email protected]/bin/python3.11
Jupyter: 5.1.3
Kernels: python3, ir
(-) Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/