Skip to content
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

Image prefixing not working #230

Open
isaacbrodsky opened this issue Aug 15, 2019 · 3 comments
Open

Image prefixing not working #230

isaacbrodsky opened this issue Aug 15, 2019 · 3 comments

Comments

@isaacbrodsky
Copy link
Collaborator

Please see uber/h3#274

I couldn't find a way to use relative paths (such as ijkp.png, relative to the images directory, or /images/ijkp.png, relative to the site root) to refer to images. Instead I had to hardcode the path prefix, which results in breaking the development version of the site.

@jckr
Copy link
Contributor

jckr commented Aug 21, 2019

please put your images in /src. Gatsby will transform them and apply various optimizations when creating the production website. That's why logically, it makes sense to have images along other parts of the source code.

With your images in /src (for instance in /src/images) you can then reference them like so in your markdown: ![optional alt text]( path to your image from /src)
for instance

@ibgreen
Copy link
Collaborator

ibgreen commented Aug 21, 2019

Should we add a chapter about images in our docs and mention this there?

@isaacbrodsky
Copy link
Collaborator Author

isaacbrodsky commented Aug 21, 2019

@jckr I assumed static/images (rather than src/images) was the correct path because npm run build fails if it doesn't exist.

I tried both:

![IJK+](/images/ijkp.png)
![IJK+](images/ijkp.png)

and the resulting img tag did not have the prefix applied in npm run build. The file was at website/src/images/ijkp.png in my repo.

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

No branches or pull requests

3 participants