crimethinc / website

Ruby on Rails app that powers crimethinc.com
https://crimethinc.com
Creative Commons Zero v1.0 Universal
102 stars 31 forks source link

Add FB:OGP tags for pages #98

Closed veganstraightedge closed 7 years ago

veganstraightedge commented 7 years ago

http://ogp.me/#types

https://adactio.com/journal/9881

Check to see if you're on an Article, then Page, then Podcast, etc, then fallback to the site root.

For page description

Objects

If you're on Article/Page/etc, check to see if there is a .summary, then a .name, then fallback to truncate(thing.content, 200) or something.

Site

If you're not on a particular thing, give a generic site description. (You can use lorem ipsum and we'll get @biofilo to update it.) Put it in en.yml.


For page URL

Use the same heuristic as above, first checking for an object page, then falling back to a generic one for non-object pages. You'll prolly need to create a helper method that returns the right protocol + domain depending on where the app is running.

Objects

To get the URL for object pages, check for the .path method on your object. If not, either create some special cases, use request.path or add .path to models as needed. Or create a path helper. Your call.

Site

Non-object pages should use the site root for the share URL.

eliduke commented 7 years ago

Fixed with #158