Skip to content

R in frontmatter with custom listing template #2202

Answered by mcanouil
nurfatimaj asked this question in Q&A
Discussion options

You must be logged in to vote

Here is an alternative, which basically includes the yaml (everything or only few selected fields) from another document within the Quarto document.

---
format: html
params:
  project-path: "."
---

```{r}
#| output: asis
#| echo: false
cat(
  "---",
  yaml::as.yaml(
    rmarkdown::yaml_front_matter(
      input = list.files(
        path = params[["project-path"]],
        pattern = 'index.Rmd',
        full.names = TRUE
      )[c("title", "any_other_field")]
    )
  ),
  "---",
  sep = "\n"
)
```

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
8 replies
@cscheid
Comment options

@nurfatimaj
Comment options

@cscheid
Comment options

@nurfatimaj
Comment options

@mcanouil
Comment options

Comment options

You must be logged in to vote
2 replies
@nurfatimaj
Comment options

@mcanouil
Comment options

Answer selected by nurfatimaj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants