### Bug description

Using Quarto 1.3.340 on macOS.

Given a website with the following layout:

```
_quarto.yml
alpha.qmd
beta.qmd
index.qmd
include/
    _common.qmd
    _default_details.qmd
    _other_details.qmd
```

The `quarto.yml`:

```yaml
project:
  type: website

website:
  navbar:
    left:
      - text: "Home"
        file: index.qmd
      - text: "alpha"
        file: alpha.qmd
      - text: "beta"
        file: beta.qmd
```

The contents of `index.qmd` are not interesting.

Here is `alpha.qmd`

````markdown
---
title: alpha
---

Alpha is first. Consider nothing else.

```{r, include = FALSE}
PROFILE <- "default"
```

```{r, child = "include/_common.qmd"}
```

There is nothing else to say about alpha.
````

Here is `beta.qmd`

````markdown
---
title: beta
---

Beta is a hammer bot.

```{r, include = FALSE}
PROFILE <- "beta"
```

```{r, child = "include/_common.qmd"}
```

The common stuff is out of the way. Give thanks to beta.
````

The `include/_common.qmd` needs to use two conditional knitr chunks:

````markdown
This is the common include file. We are the `r#PROFILE` profile.

-   Be prepared. Some very interesting text is about to appear.

```{r, child=if(PROFILE=="default") "include/_default_details.qmd"}
```

```{r, child=if(PROFILE!="default") "include/_other_details.qmd"}
```

After we gave you all of that, is there anything more?
````

The two nested include files are fairly simple.

The `include/_default_details.qmd`:

````markdown
-   The details you get by default are amazing.
````

The `include/_other_details.qmd`:

````markdown
-   When you are not the default, you can often feel left behind.
````

This is quite a lot of complexity, especially when `include/_common.qmd` contains many conditional blocks.

It would be good to avoid the need for R and knitr to accomplish:

1. Per-document variables that can be used by included files for text replacement with variable short-codes.
2. Per-document variables that can be used by included files to make decisions about what text to include in the render.

This example was the result of porting an include file from mkdocs that looked like:

````markdown
This is the common include file. We are the {{ PROFILE }} profile.

-   Be prepared. Some very interesting text is about to appear.

{% if PROFILE == "default" %}
-   The details you get by default are amazing.
{% else %}
-   When you are not the default, you can often feel left behind.
{% endif %}

After we gave you all of that, is there anything more?
````


### Steps to reproduce

_No response_

### Expected behavior

_No response_

### Actual behavior

_No response_

### Your environment

_No response_

### Quarto check output

_No response_
cscheid
2023-05-26T16:02:42Z
aronatkins
enhancement
v1.4
closed
FR: conditional content based on metadata
https://github.com/quarto-dev/quarto-cli/issues/5707