Some websites allow users to post content with links to other sites and have previews for these links displayed alongside with the posts. Those are typically social media sites, and we’ll refer to them as “social media” in this diary entry. Examples of such sites include: - forums based on Discourse, particularly OpenStreetMap Community Forum - microblogging platforms based on Mastodon, particularly en.osm.town
There are many more of course, with some more widely known examples, such as Facebook and Twitter. We’re primarily interested in the listed above because they are directly related to OpenStreetMap.
A preview usually includes a page title followed by a longer description and an image. Typically when a submitter makes a post with a link, the social media site runs a bot to download the linked web page and scan it for metadata. The metadata usually includes textual attributes and links to preview images. The bot then downloads the images and assembles the final preview to be shown to other users.
Metadata
Here we’re interested in previews of pages on the OpenStreetMap website.
Usually the links someone posts are to pages of map locations, editable osm elements (nodes, ways and relations), changesets and diary entries.
All of those pages include metadata in one of the formats suitable to generate previews, The Open Graph protocol.
The Open Graph metadata consists of several <meta>
html elements inside the web page <head>
.
The degree to which metadata on OpenStreetMap website pages allows generation of a useful previews however varies. Metadata on diary pages is usually sufficient to build reasonable previews. As an example, we can look at the html source of this diary entry: