-
I'm trying to dynamically create a block of HTML with an image, but it seems that during the compilation, the image isn't picked up.
A similar approach works, if the image is placed somewhere on a *.md page and the path points to the built-directory
I have seen that including images in CSS isn't yet an option either. What would be the best strategy for now to make sure the images is loaded? Trying to place the HTML snippet on each page? |
Beta Was this translation helpful? Give feedback.
Answered by
mythmon
Apr 14, 2025
Replies: 1 comment 5 replies
-
You need to reference the file using d3.select(sideBar)
.append('div')
.attr('class', 'logo')
.append('img')
.attr('src', FileAttachment('../../assets/images/logo.png").href)
```
That will always resolve to the URL of the image when deployed, including when the filename includes a hash for uniqueness. It also tells Framework to include the file in your output bundle. |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
spandl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to reference the file using
FileAttachment
.