kotlinx.html icon indicating copy to clipboard operation
kotlinx.html copied to clipboard

OpenGraph meta tags support

Open sanderploegsma opened this issue 6 years ago • 1 comments
trafficstars

The current implementation of HTML <meta> tags only include the name and content attributes, which makes it impossible to add OpenGraph tags, which are specified as follows [1]:

<html prefix="og: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
...
</head>
...
</html>

As a workaround, it's possible to wrap the raw HTML inside unsafe, but I'd prefer not to.

[1] http://ogp.me/

sanderploegsma avatar Apr 18 '19 08:04 sanderploegsma

Someone in the #ktor channel on Slack pointed me in the following direction:

meta {
    attributes["prefix"] = "og http://ogp.me/ns#"
    attributes["property"] = "og:title"
    content = "title"
}

Although not perfect, it's a better solution than raw HTML inside unsafe

sanderploegsma avatar Apr 18 '19 08:04 sanderploegsma