pursuit icon indicating copy to clipboard operation
pursuit copied to clipboard

Support open graph metadata for package and module pages

Open paf31 opened this issue 8 years ago • 6 comments

I think it would be nice to link to pages from Twitter and see a description in the link:

http://ogp.me/

paf31 avatar Oct 28 '17 00:10 paf31

These properties from OGP would be good start with:

<meta property="og:title" content="PACKAGE_NAME" />
<meta property="og:url" content="PACKAGE_URL_IN_PURSUIT" />
<meta property="og:image" content="LINK_TO_IMAGE_ON_PURSUIT" />
<meta property="og:description" content="PACKAGE_DESCRIPTION"/> 
<meta property="og:site_name" content="Pursuit" />

chexxor avatar Jan 27 '18 22:01 chexxor

Some useful links to help us decide which meta attributes to use.

https://www.bruceclay.com/blog/how-to-use-social-meta-tags/#twitter-card https://search.google.com/structured-data/testing-tool/ https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started http://schema.org/SoftwareSourceCode

Shouldn't use an image, though, as it becomes huuuge on Facebook posts.

chexxor avatar Jan 28 '18 00:01 chexxor

Work is in progress as a result of today's hack session - https://github.com/joncfoo/pursuit/tree/338-opengraph

joncfoo avatar Jan 28 '18 00:01 joncfoo

Nice! The description from bower.json should be accessible via the PackageMeta type, I think. You'll have to do something clever to be able to obtain that value without performing an extra database lookup though.

hdgarrood avatar Jan 28 '18 15:01 hdgarrood

Yea, I'm not sure what the best way is to obtain the description. I was thinking to utilize the package lookup functions that are already built ... the pages are only rendered once by the backend and then cached so it should be fine to do the expensive operation once? If that's not ok, what would you suggest @hdgarrood ?

joncfoo avatar Jan 28 '18 15:01 joncfoo

I think what we want is some way of (optionally) specifying in individual handlers what the ogp description should be. Maybe we could define a variant of defaultLayout, or maybe Yesod's widget functionality could be appropriate for this?

hdgarrood avatar Jan 28 '18 16:01 hdgarrood