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

add api proxy route #107

Open
swyxio opened this issue Sep 5, 2022 · 3 comments
Open

add api proxy route #107

swyxio opened this issue Sep 5, 2022 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@swyxio
Copy link
Owner

swyxio commented Sep 5, 2022

seems like a nice thing to always have by default? https://sami.website/blog/SvelteKit-API-reverse-proxy

from https://twitter.com/samijaber_/status/1566855729692250112

@ak4zh
Copy link
Collaborator

ak4zh commented Sep 20, 2022

A slightly unrelated comment:

I recently added OG image feature using the proxy request method in svelte-git-cms-template
https://github.com/ak4zh/svelte-git-cms-template/blob/1fbcfe0d61752c588cb7cf255d4c3d0d58def615/src/hooks.server.js#L9

It came out really nice. (https://sw-yx--swyxkit.ak4zh.com/blog?tags=Published)
But it's using an external opensource API to generate the image. I do not like the idea of depending on an external API to generate the image which may shut down at any anytime. So haven't attempted to implement it on swyxkit.

So I am thinking of some better options, would like you to hear your thoughts.
The idea is if we can create a svelte component that will accept the props title, description, image, etc, and create the HTML markdown with tailwindcss using https://svelte.dev/docs#run-time-server-side-component-api, which we can convert to an image using dom-to-image and serve as an OG image.
This obviously will be a separate package we can import but yeah what are your thoughts about the whole idea?
Does it look like a viable solution?

@swyxio
Copy link
Owner Author

swyxio commented Sep 22, 2022

hmm! yeah i dont mind it. i m not familiar with dom-to-image though, but its worth a shot, i always think a nice og image is a mark of polish on a website.

@ak4zh
Copy link
Collaborator

ak4zh commented Sep 23, 2022

Yes OG image really polishes the site.
I did some more tests and realised we can do this with pure SVG instead using <foreignObject> no need for dom-to-image dependency either.
Not sure if OG image supports svg format though, so may be I need to find a way to serve SVG as png in svelte

@swyxio swyxio added help wanted Extra attention is needed good first issue Good for newcomers labels Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants