CDRH / orchid

Rails Engine for site integration with CDRH API
MIT License
3 stars 0 forks source link

Add basic Open Graph meta elements #122

Open techgique opened 5 years ago

techgique commented 5 years ago

Ref: https://neilpatel.com/blog/open-graph-meta-tags/ and https://omahacode.com/open-graph-protocol/

I think we could fairly trivially add title and description with the same as the <title> and meta description contents.

I think we should also designate at least one image per project so we can add the image field as well. This will make sharing links to our Orchid-powered sites look nicer on social media.

I'm imagining we would default these to site-wide values and allow changing @title, @description, and @page_image or similar for when we actually go in and improve our HTML titles, description, etc.

jduss4 commented 4 years ago

Somewhere there is a branch (possibly for the old cather letters app?) where I started adding that kind of thing but maybe with JSON-LD and Coins or something? I don't believe that I had started adding any Open Graph stuff, since it is facebook specific and I was looking for more general things, but I'm sure that OG is now widely adopted by lots of people outside of facebook, so probably pretty useful. The more meta elements the better, I reckon :)

I definitely agree that it will be important to be able to change the description and preview image and such for all the pages of the site!

jduss4 commented 4 years ago

Ah yes, looks like it was JSON-LD I was working on https://github.com/Willa-Cather-Archive/willa-cather-archive/commit/13091a5111bd98f25225e66ddfeffc028d27d913

techgique commented 4 years ago

Yeah, I think Open Graph is quite widely used by websites to pull in metadata for pages. Such as the preview image and blurb Slack shows when some links are posted.

Could that JSON-LD be worked into Orchid based on required fields in our API index?

jduss4 commented 4 years ago

I don't think we have any "required" fields beyond identifier, although one of the things I'd like to implement in datura when adding a field validator is to make a few things required....like perhaps title, collection, and uri_data.

I'm sure that any of those could be worked into JSON-LD and that we could easily do a "if description then ` or whathaveyou to avoid empty tags. Ideally we'd have a little information in there about us as the providers of the content, the original publisher, date, author, etc, for the purpose of populating bibliographies! I'd love to be able to support basic Zotero stuff: https://www.zotero.org/support/dev/exposing_metadata

The idea of zotero being able to scrape our sites is already in this issue: https://github.com/CDRH/orchid/issues/60