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
Add Open Graph meta tags #438
Conversation
… 'summary' type for better Slack unfurling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small style problem, otherwise looks good!
R/build-home.R
Outdated
@@ -31,6 +31,7 @@ build_home <- function(pkg = ".", path = "docs", depth = 0L, encoding = "UTF-8") | |||
pkg <- as_pkgdown(pkg) | |||
path <- rel_path(path, pkg$path) | |||
data <- data_home(pkg) | |||
data$opengraph <- list(description=pkg$desc$get("Description")[[1]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add spaces around =
?
Fixed a few |
Thanks! |
The Open Graph protocol and Twitter Card properties provide standards for website/page metadata. One important application of them is in providing previews when sharing links, whether on social media or on services like Slack.
This PR implements some of these meta tags, enough to give a preview of a pkgdown site link like this (on Slack):
Specifically, it:
og:title
,og:description
,og:image
, andtwitter:card
meta tags to the head.html template;og:description
It's getting the job done for me on sites I've built with it, but it is not what I would consider a complete implementation. It needs documentation, more tests, and it's worth considering what an appropriate "description" should be for some of the other pages (reference index, news, etc.). But before I proceeded with that, I wanted to put this out there, gauge interest, and get design feedback.