Absolute vs. relative image references in markdown files #30244
Unanswered
samajammin
asked this question in
Help
Replies: 1 comment 2 replies
-
Do you use / want to use |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey folks! I'm curious if there's any recommendations/best practices around re-using images across markdown files.
The problem:
Currently our codebase stores images related to a markdown file within the directory of the file.
Here's an example of our file structure:
Then from within the markdown file (
index.md
), we reference images with a relative path, e.g.This works perfectly but has gotten complicated once we've added translations of files, in which we mirror the file structure of our English files but nested deeper within our file structure (under a
/translations/
directory):Currently this forces us to update the relative paths to our image files, so e.g. from
src/content/translations/es/developers/tutorials/erc20-annotated-code/index.md
we have to update the image reference fromto
Ideal situation for us would be to 1) not have to alter our image references at all & 2) not have to copy images into the translation directories. Is there a recommended approach here?
e.g. is there a way to update all markdown images to reference an absolute vs. relative path? So we could do something like:
Other avenues we're considering:
A script to somehow automatically update the relative paths of image references
Re-organizing our translated files to live within the same file structure, e.g.
This would require some significant refactoring of other code elsewhere tho 😕
Thanks in advance for your input!
Beta Was this translation helpful? Give feedback.
All reactions