ryamlr-markdownquarto

Quarto trying to render script files


I'm putting together an academic website with a publications section. I've written a script that will turn a bibtex file into article-by-article quarto and bibtex files that then use a custom template. So, the structure of this part of the website looks like.

|
|
|--publications
    |- index.qmd
    |- bib_2_qmds.R
    |- _ejs 
       |
       -- article.ejs
    |
    |
    |-- articles
        |
        |-- article_1
            |
            |-- index.qmd
            |-- article_1.bib

With many more articles.

The YAML for the publications index.qmd file is as follows

---
pagetitle: "Publications"
toc: false
title-block-style: default  # default, plain, none
page-layout: full
listing:
  - id: articles
    contents: articles/**/*.qmd
    template: _ejs/article.ejs
    categories: false
    sort:
      - "year desc"
      - "title"
    sort-ui: [year, title, author, publication]
    filter-ui: [year, title, author, publication]
    page-size: 100
    field-display-names: 
      publication: "Publication"
      year: "Year"
format:
  html: 
    fontsize: 1.4em
---

However, when I go to render this listing page, it tried to render bib_2_qmds.R - which I thought it shouldn't, given how I've specified the contents. Why does this try to render the script?

Preparing to preview
[1/1] publications/bib_2_qmds.R
ERROR: Expected YAML front matter to end with '---'

Stack trace:
    at validateDocumentFromSource (file:///Applications/quarto/bin/quarto.js:120442:13)
    at eventLoopTick (ext:core/01_core.js:178:7)
    at async renderFileInternal (file:///Applications/quarto/bin/quarto.js:123882:36)
    at async renderFiles (file:///Applications/quarto/bin/quarto.js:123684:9)
    at async renderProject (file:///Applications/quarto/bin/quarto.js:124209:23)
    at async serveProject (file:///Applications/quarto/bin/quarto.js:148207:20)
    at async _Command.actionHandler (file:///Applications/quarto/bin/quarto.js:149122:5)
    at async _Command.execute (file:///Applications/quarto/bin/quarto.js:9840:7)
    at async _Command.parseCommand (file:///Applications/quarto/bin/quarto.js:9717:14)
    at async quarto (file:///Applications/quarto/bin/quarto.js:175526:5)

Solution

  • YAML configuration options (content, exclude, etc.) control what gets included in the listing display. These won't prevent Quarto from rendering the rest of the files during the build process.

    If you want to skip rendering specific files either prepend their name with an underscore, like _bib_2_qmds.R or create a subdirectory like _scripts and move all the files that you don't wish to be rendered there.

    |
    |-- _scripts/
        |-- bib_2_qmds.R
    |-- publications/
        |-- index.qmd
        |-- _ejs/
        |-- articles/
    

    I have not tried these other solutions myself, but it seems to be possible to achieve what you want in some other ways:

    Using .quartoignore file https://quarto.org/docs/extensions/starter-templates.html#creating-a-template, to ignore specific files

    bib_2_qmds.R
    

    Using render targets:https://quarto.org/docs/websites/#render-targets

    project:
      render:
        - "*.qmd"
        - "!bib_2_qmds.R"