cubing / alg.cubing.net

▶️ Multi-purpose puzzle viewer – the old generation of alg/reconstruction viewing and sharing. Superseded by Twizzle.
https://alg.cubing.net
Other
184 stars 32 forks source link

[enhancement] og:image being intial state when "alg" is in the url, and other og: properties #145

Closed robertvandeneynde closed 6 years ago

robertvandeneynde commented 6 years ago

When sharing a link on facebook or Whatsapp, the image is not very useful, we see a solved cube, that's probably not what we want. I suggest when the url has the query parameter "type=alg", the image should be the intial state of the cube (ie. what it solves).

For example I share this nice OLL : https://alg.cubing.net/?title=Untying%20(OLL)&stage=PLL&type=alg&alg=F_R_U-_R-_U-_R_U_R-_F-

The preview would be with the title "Untying (OLL)" with this image :

screenshot_2018-06-17_22 11_58

This has to be server side unfortunately but i suggest that the server would write this properties :

    <meta property="og:image" content="https://alg.cubing.net/initial-state?title=Untying%20(OLL)&stage=PLL&type=alg&alg=F_R_U-_R-_U-_R_U_R-_F-" />
    <meta property="og:title" content="Untying (OLL)"/>
    <meta property="og:description" content="F R U' R' U' R U R' F'"/>

For the image, a separate url "initial-state" would be coded on the server to generate the image, the browser would cache it, but if performance is concerned, the image can be cached on the server. The image size can be quite small, well, being a cube. But one could look at Facebook/Reddit recommendation here or here.

lgarron commented 6 years ago

Yeah, this is issue #54. I'll think about this after the ongoing v2 rewrite, but for now I can't dedicate time to it. :-(

(If you have more thoughts, feel free to continue at #54.)

robertvandeneynde commented 6 years ago

I think I will first code a url on my server and redirect it to alg.cubing.net, then maybe it will be easier to merge it later !

lgarron commented 6 years ago

I think I will first code a url on my server and redirect it to alg.cubing.net, then maybe it will be easier to merge it later !

Will be glad to see what you come up with!

I will probably be very picky about shipping anything to production if the images don't look exactly like they do on the website, but it would certainly be nice to have somewhere to start from.