-
Notifications
You must be signed in to change notification settings - Fork 394
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
blog: make meta image URLs stable #1238
Comments
This should be doable! Technically, we already have our blog images saved on a stable url. (December 2021 Community Gems Image) But we would want our meta images to be smaller than that... Two solutions I could think of so far:
|
Update! I looked into redirecting the meta image urls, but couldn't think of way to accomplish this with the way our app is set up. 🤔 But this solution doesn't involve recreating any images, so if anyone has any ideas for this, please let me know! As for my other solution idea, I looked into editing the blog images and giving them fixed url paths. The only way to give an image a fixed path in Gatsby (as far as I know) is to place images in the #3161 has a prebuild script that runs in production. When it runs it uses What do you think, @iterative/websites? Any other ideas for easier solutions? |
How Gatsby determines the generated image URLs? If it's not random and can be customized, it may be easier to set a URL/pathname formatting option. |
Unfortunately, Gatsby doesn't seem to have a way to set or customize image urls. All image urls are usually something like |
The primary solution I'd think of is adding some post-bootstrap code that queries all blog post nodes and their images, then make the largest versions accessible at the slug-only URL we want. We could use some external solution like #3161 but I think it'd be best to avoid that if at all possible. As far as that "somehow", there's a few options:
There's also the issue of actually using those images in the pages, I assume we'll want to if any embed automatically pulls the image. My first guess is that we'll have to mangle the |
I didn't think of that! I'll look into it!
I actually did this on my draft pr! It worked fine, but I think I saw an error somewhere which made me do things a different way. But I'm testing again and not seeing the error... If the error doesn't show up again, we should be able to do this just fine if we decide on this solution.
I looked into redirection, but I couldn't figure out a way to give our node backend access to the static urls that Gatsby gives images by default. |
Maybe we could look into writing out a json file that contains the contents of the redirects created with Gatsby It would also introduce the "happy path" Gatsby redirect API to our system and possibly allow us to transition the whole thing if it makes hosting our redirects more possible on other platforms. |
Seems key line |
Thanks for the ideas, @rogermparent! Copying the files into the |
@julieg18 I'd say we should go for |
I originally worked on a solution for just copying the images created by |
@julieg18 I went through the code I tried fixing the part of the code you had commented on. ie using the gatsby-plugin-image. I also tried debugging that but yes some of the images are not fully converted at the time of moving so that error seemed to persist. Actually, I did some comparisons around the solutions,
|
Right now when we change some libraries, setting, redeploy, etc, image URLs change and break our forum topics, for example:
https://discuss.dvc.org/t/dvc-heartbeat-feburary-20/318
We need to make some "proxy" URLs that will be stable and depend only on a post slug.
The text was updated successfully, but these errors were encountered: