We've been finding ourselves needing a lot of links on Dat sites. For instance, we want a way to specify the issues board for an app, or a place to pay authors.
We're thinking about adding a links
field to the dat.json to keep this unified.
Approach 1, as an array:
{
"title": "Beaker browser homepage",
"links": [
{"rel": "payment", "href": "https://opencollective.com/beaker"},
{"rel": "author", "href": "dat://taravancil.com", "title": "Tara Vancil"},
{"rel": "author", "href": "dat://paulfrazee.com", "title": "Paul Frazee"},
{"rel": "https://archive.org/services/purl/purl/bll/resource/issues-board", "href": "https://github.com/beakerbrowser/beakerbrowser.com/issues"}
]
}
Approach 2, as an object with the "rel" as key:
{
"title": "Beaker browser homepage",
"links": {
"payment": "https://opencollective.com/beaker",
"author": [
{"href": "dat://taravancil.com", "title": "Tara Vancil"},
"dat://paulfrazee.com"
],
"https://archive.org/services/purl/purl/bll/resource/issues-board": "https://github.com/beakerbrowser/beakerbrowser.com/issues"
}
}
Any opinions?
For me it depends a bit on where and how the links would be used. I find the first easier to read as a human, while the second one is probably a bit easier to use in code. If I have to pick between the two, I'd go for easier on humans.
I don't really like the schema-like approach for the issues-board in the example. (if that is indeed the meaning of that url, I have no way to be sure). I'd prefer that the contents of 'rel' is something human-readable another attribute where the schema information can go, something like: