contentz-tech / build

Build your Contentz website for production

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate social images on runtime in the server

sergiodxa opened this issue · comments

Is your feature request related to a problem? Please describe.
Right now we need to keep every possible social image in the repos of the website, eventually this make the repo heavier due the big amount of images.

Describe the solution you'd like
Generate a Node.js function exposing @contentz-tech/social using HTTP, it should be used like:

GET /api/social?title=My article title&description=My article description

This API endpoint should reply with the generate image, not keeping it on disk, and with a Cache-Control header to ensure proper CDN y browser cache, since the title and description are in the URL any update on those will invalidate the social image.


From the HTML side, we will add the <meta> tag pointing to that endpoint and with the page title and description. For the special cases (home, CV, articles, links, error) we can generate the same tag but with the title and description based on what we want to generate, this will simplify lots of code too.