Skip to content

Commit

Permalink
Merge pull request #1392 from mcanouil/docs/tip-include-path
Browse files Browse the repository at this point in the history
docs: add tip about absolute path in include shortcode important callout
  • Loading branch information
cwickham authored Oct 22, 2024
2 parents 07efbfe + 199007c commit a072df8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/authoring/includes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ To include a file, add the `{{{< include >}}}` shortcode at the location in your

::: callout-important

Include shortcodes are equivalent to copying and pasting the text from the included file into the main file. This means that relative references (links, images, etc.) inside the included file resolve based on the directory of the main file not the included file.
Include shortcodes are equivalent to copying and pasting the text from the included file into the main file.
This means that relative references (links, images, other includes, etc.) inside the included file resolve based on the directory of the main file not the included file.
Use absolute (to the project root) paths for links, images, or other includes, in included files to ensure they resolve correctly, *e.g.*, `[A Figure Reused](/path/to/image.png)` or `{{< include /path/to/_file.qmd >}}`.

It also means that if the included file has a metadata block, that block will take effect in all included files. In most cases, having metadata blocks in an included file will cause unexpected behavior.

Expand Down Expand Up @@ -110,4 +112,4 @@ code span.in {
font-style: normal;
}
</style>
```
```

0 comments on commit a072df8

Please sign in to comment.