3

Is there a recommended way to create a quarto site navigation for parameterized qmd reports? For instance, say I have the following patient_report.qmd file:

---
params:
  patient: null
title: "Patient Report for `r params$patient`"
---

This is a patient report for `r params$patient`.

This report takes a patient param. If I also included in index.qmd with these contents:

---
title: "Home Page"
---

So if I ran the following code:

quarto render index.html
quarto render patient_report.qmd -P patient:A --output A_patient_report.html
quarto render patient_report.qmd -P patient:B --output B_patient_report.html
quarto render patient_report.qmd -P patient:C --output C_patient_report.html

I would get 3 different patients reports with different contents. It's not clear to me how one could string these reports into a website. For instance, one could explicitly list the HTML files in the _quarto.yml file:

project:
  type: website
  output-dir: _site

website:
  title: "Test Website"
  navbar:
    left:
      - href: A_patient_report.html
        text: Patient A Report
      - href: B_patient_report.html
        text: Patient B Report
      - href: C_patient_report.html
        text: Patient C Report

But this would require me to list out all patients. Is there a recommended way of doing this?

TinyHeero
  • 580
  • 1
  • 4
  • 18
  • Not only is this a cumbersome approach, it doesn't work because all files are rendered to a folder named `patient_report` rather than `a_patient_report`, `b_patient_report` etc. Did you ever find a solution to this? – Ratnanil Jul 17 '23 at 07:20
  • There are some relevant discussions on this topic on GitHub, e.g. [this one](https://github.com/quarto-dev/quarto-cli/discussions/961). I ended up automatically generating *qmd* files from a `_template.qmd`, which quarto then automatically rendered. Not very elegant, but AFAIK there are not elegant solutions ATM. – Ratnanil Jul 17 '23 at 07:51

0 Answers0