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
feat: Add OGP to package page #417
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! @donjo or @josh-collinsworth could you review the design of this OG image? The generation code looks good.
This is great work overall, and I'm happy to see this. As far as design, however, I want to be sure we're very thorough. Most importantly, I'd like to see tests across a wide range of packages. What happens when the package namespace and title are wider than the image, for example? Will the version number and "latest" badge wrap to a new line? If they do, will it push other content down? Are there any scenarios where text could overlap? Same for the description; how does it flow when a package has very long text? Does it still look right when the package doesn't work with as many things, or has a different score or publish date? Then, aesthetically, there are a few nitpicks I think we could tighten up before this is fully ready (see the below image to help illustrate):
I don't know exactly how easy or difficult all of this is given that we're just rendering an image on the fly, but I think the more of these we can address, the better the final outcome will be. :) |
@josh-collinsworth, thank you for your advice! I'll improve it, following your advice. |
@josh-collinsworth, I fixed some. |
@nakasyou That's looking much better. Question: how can I see these generated images on the site? The social share preview seems to still be the default image when I'm attempting to see the preview locally. |
Thank you!
OGP was in conflict with the default of |
Yes, that'd be great - if you grep for You can then default the frontend root to |
Hi @lucacasonato, thank you for advice.
It's difficult for me to do it. And even if I could do it, I may destroy environment. So could you do it, please? |
Sure! |
One more change I'd like to see: it seems how descriptions are truncated a little too aggressively now. Even packages with very short descriptions are getting cut off. Could we at least allow the description to wrap to two lines or so? Maybe even move the three columns down a little if we need to? |
@josh-collinsworth, sorry for late. |
@nakasyou This is looking really good! Thanks for all your work on this! I have two remaining nitpicks, but I think only one is immediately important. First, and more importantly: can we prevent text from wrapping mid-word in the description? This isn't great for legibility, and it could also cause some unwanted "words" to appear where they shouldn't. (e.g., And second, less importantly: when the package title wraps to a new line, is it possible to keep the version aligned? I'm much less worried about the second item; I think that can be an edge case we clean up later. But the first is bound to affect quite a few packages, and potentially cause confusion or unwanted appearance. |
If you merge this PR, you can show package thumbnail in SNS such as X and Discord.
Example thumbnail (
@std/path
):