-
Notifications
You must be signed in to change notification settings - Fork 982
docs: add tip about absolute path in include shortcode important callout #1392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I'd prefer if we didn't nest callouts. |
|
I noticed an issue and was filling it before reverting this^^ |
docs/authoring/includes.qmd
Outdated
| 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, 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 and images in included files to ensure they resolve correctly, *e.g.*, `{{< include /path/to/file.qmd >}}`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the example. Shouldn't it be an example of a link or image, not an include?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, both were the cause of issues to users. I've added an image example as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean when using {{< include >}} inside an included file? In which case, it might be clearer to inlcude that in the examples of references :
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.*, ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
/deploy-preview |
|
🚀 Deployed on https://deploy-preview-1392.quarto.org |
|
Thanks @mcanouil ! |
|
Successfully created backport PR for |
This pull request adds a tip to the documentation about using absolute paths in the include shortcode. The tip explains that using absolute paths ensures that links and images in included files resolve correctly regardless of where the file is included via the shortcode.
Motivation: several users were bitten by this. The explicit tip might help avoid the issue.