Skip to content

Update images.md #1090

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Update images.md #1090

wants to merge 10 commits into from

Conversation

lcawl
Copy link
Contributor

@lcawl lcawl commented Apr 10, 2025

Relates to elastic/docs-content#1079

The image guidelines seem to imply that we can use relative image paths but they seem problematic when you go from a local build to a fully assembled build. This PR therefore recommends using absolute paths.

@lcawl lcawl requested a review from a team as a code owner April 10, 2025 22:06
@lcawl lcawl requested a review from reakaleek April 10, 2025 22:07
@lcawl lcawl added the documentation Improvements or additions to documentation label Apr 10, 2025
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a note about this behavior!

Added a suggestion on the wording, nothing wrong with relative paths they just can't extend beyond the toc.yml subtree.


Images can be referenced from the top-level `_static` dir or a local image dir.
:::{note}
If you reference an image using a relative path, it must be relative to the `toc.yml` or `docset.yml` rather than relative to the page that uses it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be a relative path but it can not go relative beyond the toc.

e.g

/images/
  - other.png
/solutions/
   /images/
      - observability-apm-app-landing.png`
   /page/
      - index.md
   toc.yml

../images/observability-apm-app-landing.png from index.md is fine because that lives in the same subtree as the toc.yml the page lives in.

../../images/other.png lives outside the toc.yml subtree so is at risk of being broken if the assembler rehomes this subtree.

`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, i've taken another go at the explanation since i think this might confuse folks


Images can be referenced from the top-level `_static` dir or a local image dir.
If a page uses an image that exists outside the folder that contains the `toc.yml` file or `docset.yml` file that contains that page, the image will fail to render and will generate warnings. Likewise, if a snippet in a [file inclusion](/syntax/file_inclusion.md) includes an image and is used in pages that exist in different `toc.yml`, the images will break.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and is used in pages that exist in different toc.yml, the images will break...

Unless the images is copied into all the folders where the re-use occurs in exactly the same relative folder structure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants