Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable preview images on social media #66

Merged
merged 5 commits into from Nov 4, 2019

Conversation

@g-oikonomou
Copy link
Contributor

g-oikonomou commented Nov 1, 2019

This commit adds support for serving Open Graph meta tags inside the HTML head. When enabled, links to the page on social media will display a preview.

NB: twitter behaves somewhat differently and may require twitter card meta tags in addition to Open Graph.

https://ogp.me/

Draft for now: Works nicely on skype. The twitter validator likes it, but I failed to make it work inside a tweet. Need to also test a couple more sites/apps. Success/failure reports welcome!

This commit adds support for serving Open Graph meta tags inside the HTML head. When enabled, links to the page on social media will display a preview.

NB: twitter behaves somewhat differently and may require twitter card meta tags in addition to Open Graph.

https://ogp.me/
@g-oikonomou

This comment has been minimized.

Copy link
Contributor Author

g-oikonomou commented Nov 1, 2019

@g-oikonomou g-oikonomou marked this pull request as ready for review Nov 1, 2019
Copy link
Owner

alshedivat left a comment

Having preview images on social media is a great idea.
Let's make images page-specific and will be ready to merge.

_config.yml Outdated Show resolved Hide resolved
@g-oikonomou

This comment has been minimized.

Copy link
Contributor Author

g-oikonomou commented Nov 4, 2019

So:

  • Added documentation in the README
  • Added support for page-specific preview images as requested. Site-wide image used as fallback.
  • og:description is now the page-specific page.title, instead of site.name. This assumes silently that the title will not contain HTML tags. If it does then we will likely end up serving invalid HTML, but I cannot think of a good way to work-around this other than ask the user to explicitly provide values for multiple OG properties. Which I don't think we want to do.
  • og:url now points to the individual page linked, not simply to the site's home page.

This is a tad difficult to test, but I tested using:

Copy link
Owner

alshedivat left a comment

Looks great! Thanks for making the changes and again for contributing.

@alshedivat alshedivat merged commit 29e99eb into alshedivat:master Nov 4, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@g-oikonomou g-oikonomou deleted the g-oikonomou:contrib/open-graph branch Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.