HumanRightsMeasurementInitiative / hrmi-dataportal

https://rightstracker.org
Other
4 stars 8 forks source link

Improve page meta information and images for social media previews [6-8 hours] #162

Open tmfrnz opened 4 years ago

tmfrnz commented 4 years ago

Currently the site only produces a generic preview and the dedicated preview image is sometimes not showing.

Meta/preview information (title, description and image) should be dependent on the specific page

iainkirkpatrick commented 4 years ago

This is tricky with the current site architecture - when social media sites attempt to generate preview content for a post, they look for specific Open Graph <meta> tags in the initial HTML served by the site server when they access a particular URL (i.e. https://rightstracker.org/en/country/NZL?as=hi). In our case, we have a single (minimal) initial HTML file that is served for all our relevant URL's, and Javascript subsequently loads on the user's browser to populate that HTML with all the content that we eventually see per page. That single initial HTML file currently just has the generic content (title, image etc - i.e. https://rightstracker.org/hrmi-og.png) built in.

So what we want is some way for our server to respond with a specific HTML file with relevant Open Graph <meta> tags when specific URL's are requested by the social media sites. There's a couple of ways we might go about this:

I realise that's probably a lot to parse... basically I'd probably suggest option 3 might be the easiest in the short-term, but ideally IMO we'd move to option 1 in the future (but probably as part of a larger piece of work towards not using a node server and pre-building all the pages). I'd estimate around a day's work to get it going (so 6-8 hours), depending a bit on which pages need custom preview content and what that content is, and how Firebase handles redirects (I haven't looked into that yet).

annemariebrook commented 4 years ago

Thanks @iainkirkpatrick. As you guessed, this is beyond my technical ability to comment on. However, I wonder if - rather than taking a comprehensive approach to this - we focus only on the option to share the country pages and rights pages (which are the ones Thalia shares the most) and have the social media preview content be the photo or icon image that is shown at the top of each of those pages, along with some very basic text from the top of the page?

tmfrnz commented 4 years ago

See also related discussions on react-helmet (the library we use to update each view's meta information), including some options