-
DescriptionI have a quarto website for a research project. I have a bunch of notebooks which I want to move to a section "Archive", and put a callout note on the top of each notebook with a notice that these notebooks are not up-to-date. I can make a separate file with the callout note like this (e.g. _deprecated.qmd): ::: {.callout-note}
Some warning about deprecated reports
::: and then include it at the begining of each notebook: ---
title: "Some notebook"
format: html
---
{{< include _deprecated.qmd >}} This works, but is there a way to include this in every qmd file in a folder automaticallly via the _metadata.yml file or something like that? I haven't been able to find relevant info on the webpage or github, but I could have missed it |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
One way to do it is to define a custom format with a filter that injects the content, and then use that custom format. Alternatively, you should be able to add a filter to every document in a directory by using directory metadata: https://quarto.org/docs/projects/quarto-projects.html#directory-metadata |
Beta Was this translation helpful? Give feedback.
-
Cool, thanks for the pointers! I haven't worked with filters before but this might be a good test case to learn about them. Though I'll probably leave it for a future project as it seems a lot more work relative to just inserting the shortcode in 10 notebooks manually (would be a different story if I need this for multiple projects and/or a lot more nootebooks. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Almost. It includes it in every file, but it adds the raw contents of the file - it does not render the quarto shortcode for a callout. <main class="content" id="quarto-document-content">
::: {.callout-note}
Some callout
:::
<header id="title-block-header" class="quarto-title-block default"><nav class="quarto-page-breadcrumbs quarto-title-breadcrumbs d-none d-lg-block" aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item">Docs</li><li class="breadcrumb-item"><a href="../../docs/archive/file1.html">Archive</a></li><li class="breadcrumb-item"><a href="../../docs/archive/file1.html">First file</a></li></ol></nav> But I could make it work then by including the html that a callout block would generate. E.g., I make a file <div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>Some callout</p>
</div>
</div> and then I have a format:
html:
include-before-body: ../_note.html This works nicely: ideally would be nice to be able to use include-before-body or something similar with .qmd files which get rendered |
Beta Was this translation helpful? Give feedback.
-
An example of the above solution: repo: https://github.com/venpopov/quarto_include_before_body |
Beta Was this translation helpful? Give feedback.
include-before-body
in_quarto.yml
might work.