Added: Now a GitHub Repository at https://github.com/RouninMedia/link-rel-social-profile/
After digging deep into a good handful of web articles - some from over a decade ago - and concluding that there absolutely is no standard format for explicitly declaring and defining a relationship between a web page and any number of related social media accounts, I'm tempted to have a go at proposing my own standard.
I'm conscious that this may appear hubristic, but at least one technical author, Adam Roberts, stated the following in 2014:
You could define many custom relationships between pages with the link
element [...] you’re not limited [...] you can define your own rel
attribute value
Source: https://www.sitepoint.com/rel-html-attribute/
So, throwing caution (and humility) to the wind...
Introducing <link rel="social-profile">
Example:
<link rel="social-profile rel-guest-author" title="Éowyn" href="https://twitter.com/éowyn" />
<link rel="social-profile rel-guest-publisher" title="Rohan Report" href="https://twitter.com/rohan-report" />
<link rel="social-profile rel-host-website" title="Gondor Gazette" href="https://twitter.com/gondor-gazette" />
The anatomy of <link rel="social-profile">
The <link rel="social-profile">
element comprises 4 Parts:
1) The href
attribute is compulsory and its value gives the URL of the related social media page or profile.
2) The rel
value social-profile
is compulsory and indicates that the URL value of the href
attribute points to a social media page or profile. This could be pretty much any resource with a URL that might be recognised as part of the social web:
- a Facebook Page
- a Facebook Group
- a LinkedIn Profile
- a Twitter Account
- a Strava Profile
- a Webmasters Stack Exchange Profile etc.
3) The second rel
value, prefixed with rel-
, is optional and indicates the type of relationship that the owner of the social-profile has to the current document.
There are no predefined values which follow rel-*
(much like the data-*
custom attribute in HTML5, any word or series of hyphenated words will suffice), though conventions may arise over time, such that where the following are used:
rel="social-profile rel-blogger"
rel="social-profile rel-writer"
rel="social-profile rel-me"
rel="social-profile rel-author"
eventually, the first three may all come to be regarded as secondary aliases of the quasi-standard:
rel="social-profile rel-author"
4) The title
attribute is optional but where it is included, it indicates which <link rel="social-profile">
elements refer to the same entity and which refer to distinct entities.
Further thoughts on <link rel="social-profile">
- There is no limit to the number of
<link rel="social-profile">
elements in one document
- There is no limit to the number of times a
rel-*
value may be reused
E.g. A website hosts an article collaboratively written by four guest writers, three of whom would like a reference to one of their social media profiles and one who would like a reference to two of hers.
The meta information might look as follows:
<link rel="social-profile rel-lead-author" title="Professor Plum" href="https://twitter.com/professor-plum" />
<link rel="social-profile rel-co-author" title="Mrs Peacock" href="https://twitter.com/mrs-peacock" />
<link rel="social-profile rel-contributing-author" title="Colonel Mustard" href="https://facebook.com/colonel-mustard" />
<link rel="social-profile rel-contributing-author" title="Miss Scarlett" href="https://linkedin.com/miss-scarlett" />
<link rel="social-profile rel-contributing-author" title="Miss Scarlett" href="https://instagram.com/miss-scarlett" />
Comparing <link rel="social-profile">
to JSON-LD + Schema.org
I wanted to see how the <link rel="social-profile">
markup immediately above compared to the same data formatted using JSON-LD + Schema.org
.
For the latter, I came up with the following:
{
"@context": "http://schema.org/",
"@type": "Article",
"author": [
{
"@type": "Person",
"name": "Professor Plum",
"sameAs": [
"https://twitter.com/professor-plum"
]
},
{
"@type": "Person",
"name": "Mrs Peacock",
"sameAs": [
"https://twitter.com/mrs-peacock"
]
},
{
"@type": "Person",
"name": "Colonel Mustard",
"sameAs": [
"https://facebook.com/colonel-mustard"
]
},
{
"@type": "Person",
"name": "Miss Scarlett",
"sameAs": [
"https://linkedin.com/miss-scarlett",
"https://instagram.com/miss-scarlett"
]
}
]
}
and I was pretty happy with this, on the basis that:
- it's very readable and clearly conveys the information it's communicating
- in terms of bytes it's around the same length as the
<link rel="social-profile">
markup
- it's formatted in an already well-established machine-comprehensible format
My only disappointment was that the JSON-LD
- unlike the <link>
markup above - didn't indicate the type of author each person represented, where:
- Professor Plum is the Lead Author
- Mrs Peacock is the Co-Author
- Colonel Mustard is a Contributing Author
- Miss Scarlett is a Contributing Author
Nevertheless, at this point, I was about to accept @MaximillianLaumeister's answer recommending JSON-LD + Schema.org
.
But then...
I pasted the JSON-LD
into Google's Structured Data Testing Tool and the tool revealed that the JSON-LD
was invalid, containing 4 Errors.
It turns out that in Schema.org
, "@type": "Article"
has a number of required values, including:
datePublished
headline
image
publisher
But once you add these four values, it turns out that:
publisher
needs to be given "@type": "Organization"
And then, once you add that, it turns out that "@type": "Organization"
has a two more required values of its own:
Once I'd got through all of that - and found a way to label Authorship Type, using "@type" : "Role"
- and the Schema.org
was finally validating, I ended up with this:
{
"@context": "http://schema.org/",
"@type": "Article",
"name" : "This Article",
"headline" : "This Article's Headline",
"datePublished" : "2020-04-21",
"image": "/this-article-image.jpg",
"author": [
{
"@type" : "Role",
"name" : "I don't know what this is supposed to be",
"roleName" : "Lead Author",
"author": {
"@type": "Person",
"name": "Professor Plum",
"sameAs": [
"https://twitter.com/professor-plum"
]
}
},
{
"@type" : "Role",
"name" : "I don't know what this is supposed to be",
"roleName" : "Co-author",
"author": {
"@type": "Person",
"name": "Mrs Peacock",
"sameAs": [
"https://twitter.com/mrs-peacock"
]
}
},
{
"@type" : "Role",
"name" : "I don't know what this is supposed to be",
"roleName" : "Contributing Author",
"author": {
"@type": "Person",
"name": "Colonel Mustard",
"sameAs": [
"https://facebook.com/colonel-mustard"
]
}
},
{
"@type" : "Role",
"name" : "I don't know what this is supposed to be",
"roleName" : "Contributing Author",
"author": {
"@type": "Person",
"name": "Miss Scarlett",
"sameAs": [
"https://linkedin.com/miss-scarlett",
"https://instagram.com/miss-scarlett"
]
}
}
],
"publisher": {
"@type": "Organization",
"name": "Tudor Mansion Publications",
"logo": {
"@type": "ImageObject",
"url": "/tudor-mansion-logo.jpg"
}
}
}
which is a lot more verbose (and arguably contains a lot more unnecessary detail) next to:
<link rel="social-profile rel-lead-author" title="Professor Plum" href="https://twitter.com/professor-plum" />
<link rel="social-profile rel-co-author" title="Mrs Peacock" href="https://twitter.com/mrs-peacock" />
<link rel="social-profile rel-contributing-author" title="Colonel Mustard" href="https://facebook.com/colonel-mustard" />
<link rel="social-profile rel-contributing-author" title="Miss Scarlett" href="https://linkedin.com/miss-scarlett" />
<link rel="social-profile rel-contributing-author" title="Miss Scarlett" href="https://instagram.com/miss-scarlett" />
Conclusions
I'm not so presumptuous to imagine that anyone else will be moving to adopt:
<link rel="social-profile">
any time soon.
Not least since I was about to ditch the idea myself, moments before I started validating the JSON-LD + Schema.org
I'd written to replace it.
But now I'm reminded just how constrained Schema.org
can be sometimes: how each @type
can have several required properties and how some of those required properties can have their own required @types
and so on in a relentless cascade of required properties and @types
, some of which ask for specific data and it isn't clear what they're asking for at all.
(e.g. "@type" : "Role"
requires the property name
but I am entirely uncertain as to what name
is supposed to be.)
So I'm wondering if:
<link rel="social-profile">
maybe isn't such a terrible idea, after all.
Added: Now a GitHub Repository at https://github.com/RouninMedia/link-rel-social-profile/