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

add details in description meta tag; and add og:description and twitter:description #1066

Closed
mikelmaron opened this issue Oct 5, 2015 · 14 comments

Comments

@mikelmaron
Copy link
Contributor

Adding more detail in the description meta-tag, and adding additional meta-tag, is an easy way to improve sharing of OSM links. For instance, a link to an OSM feature can include the name and type of feature in the description meta-tags.

Related to #739, which specs out possibilities and issues for addition of map image during sharing.

@tomhughes
Copy link
Member

Why can't all these damned sites agree on one standard? How many of these tags are we going to be expected to add? How big does a site have to be before it becomes impossible for us to tell them to go take a long walk off a short pier when they come up with this nonsense...

@mikelmaron
Copy link
Contributor Author

Yea, turns out they've kinda agreed. I think supporting the Open Graph standard should be enough.

http://stackoverflow.com/a/29067915

@woodpeck
Copy link
Contributor

woodpeck commented Oct 5, 2015

Does that mean we can kick out the tags "contact:facebook", "facebook", "contact:google_plus", "contact_twitter", "twitter", etc.?

@HolgerJeromin
Copy link
Contributor

@woodpeck This is only about the HTML meta data for osm.org website, for sharing an URL.

@mikelmaron
Copy link
Contributor Author

For reference, here is where the meta-tags are added.

https://github.com/openstreetmap/openstreetmap-website/blob/master/app/views/layouts/_head.html.erb#L28-L29

Not clear to me if both description and og:description metatags are necessary to cover everywhere we want better descriptions. Certainly for title, I think it just pulls from the title tag, doesn't require og:title.

In either case, need to set up the value of this/these metatags to

def printable_name(object, version = false)
or something more expansive (including the type of feature)

@tomhughes
Copy link
Member

The big problem I see is that we will have no idea what language to use for the description because what twitter/facebook/whatever fetches the page they won't be logged in, or presumably sending any Accept-Language header so we will just default to english.

In any case in the first instance I was assuming we would just do a simple fixed description, not try and generate something custom for each different page.

@mikelmaron
Copy link
Contributor Author

Yea, and there's no way to add alternate languages to og. So keep it simple, and set description to printable_name, and force to use the English text and the default "name" tag

@pnorman
Copy link
Contributor

pnorman commented Oct 6, 2015

og:image is a required property. Given we don't have a way to generate an image specific to the graph object, for the same reasons as #739, what could we do here?

There is the og:locale property, so we can do <meta property="og:locale" content="en_GB" /> It also allows for og:locale:alternate, to specify alternate locales which are available, but doesn't talk about how to retrieve those alternate locales.

https://developers.facebook.com/docs/opengraph/guides/internationalization#bestpractices discusses OG localization in the context of Facebook, and a X-Facebook-Locale header is used.

and add og:description and twitter:description

I can't find a reference to twitter:description on the twitter graph docs - could you provide a link to documentation?


@mikelmaron Could you provide what you think the open graph properties would be for a few example objects?

@mikelmaron
Copy link
Contributor Author

After looking into it more, the only addition needed now is og:title, set to the same as title; some sites, like Slack, only pay attention to the OG tags.

Facebook uses title if og:title is not set, so ok there. Could consider adding support for X-Facebook-Locale as @pnorman suggests, later on.

So in summary, I think adding og:title set to printable_name should be sufficient to close out this issue.

@pnorman
Copy link
Contributor

pnorman commented Oct 12, 2015

After looking into it more, the only addition needed now is og:title,

What about og:image being required?

@mikelmaron
Copy link
Contributor Author

What about og:image being required?

Agree that it would be great to do more with og:image than serve the logo, but that should be sufficient for now, and doesn't need to change.

Also, "required" in practice isn't enforced. There are four required OG tags, but right now OSM just has the one.

@HolgerJeromin
Copy link
Contributor

Can this be closed after e62e879 ?

@tomhughes
Copy link
Member

Well that depends - this ticket is sufficiently vague that it's hard to know what will count as it being completely fixed.

In particular this specifically asked for description which we are not currently adding.

My plan was to extend things to allow further page specific customisation and then, within reason, allow people to offer patches to make pages add more specific details.

@mikelmaron
Copy link
Contributor Author

We whittled down the requirement in the comments. Thanks @tomhughes. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants