-
Notifications
You must be signed in to change notification settings - Fork 83
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
Docs: Add "how to add images" to the Astro starter #617
Comments
May be that https://github.com/Thinkmill/keystatic/blob/main/packages/keystatic/src/form/fields/document/DocumentEditor/image.tsx needs to generate the relative slug differently? Does Next.JS glob for the images? |
Hey! Good catch — we need to support the proper Astro way to handle images with Astro assets. I've opened a PR that will update the template to do just that — if you want to keep working on your existing project, you can copy the config chages from that PR 👍 keystatic/templates/astro/keystatic.config.ts Lines 20 to 23 in 094f890
|
😓 I've somehow run into an issue where that resolves for me in the editor, but not when astro renders the markdoc... I'll have to investigate into it more... |
@simonswiss I created a new setup following your video yesterday but it looks like the changes you made in #621 are not released, yet? On a side note, I tried to wrap my head around how to figure out what is released, but given the different changelogs and packages and the way the changelog-UI works (eg without dates in the changelog) that is not quite easy. I found that in keystatic/templates/astro/CHANGELOG.md Line 14 in 7d67aa3
Q: How to setup a posts/images folder structure that stores the images next to the post? In #621 you stored the images away from the posts. However, this will be messy once I delete a post and cannot find the corresponding images. I suggest to create the default config in a way to store the posts and images next to eachother… (Btw, Astro has no recommendations on this in their docs, eg not in https://docs.astro.build/en/core-concepts/project-structure/ nor in the images section.)
|
this also prevented me from resolving the editor image in Next.js. should I open another github issue? |
https://github.com/Thinkmill/keystatic/blob/main/docs/src/content/pages/installation-astro.mdoc
^ It'd be great to include "how to add images and ensure they're resolved" to the astro docs, since there seems to be some awkwardness with how the paths are generated:
with
src/content/posts/first-post.mdoc
in the starter, uploading an image from the ui addssrc/content/posts/first-post/content/image.jpeg
and links![](image.jpeg)
insrc/content/posts/first-post.mdoc
, which Astro ends up not resolving.Maybe worth changing the config / reccomending changing the config for a blog w/ images or improving the path generation code?
Changing
keystatic.config.ts
topath: "src/content/posts/*/"
doesn't seem to help, since then the image is still referenced as![](image.jpeg)
when it's in the./content/
directoryThe text was updated successfully, but these errors were encountered: