4 ms·
Ok, here is my proposal. Use a link to an external resource with all the information you want attached to that page like: <link rel="data" type="data/json"
by Kilimanjaro 15y ago
Ok, here is my proposal. Use a link to an external resource with all the information you want attached to that page like:
<link rel="data" type="data/json" href="http://example.com/recipes/chicken.js" />
<link rel="data" type="data/xml" href="http://example.com/recipes/chicken.xml" />
The resource can be cached, served static or even included in the page inside a <script data> tag
Here is the html:
<div itemid="1234">Chicken marsala</div>
<div itemid="1235">Fried chicken</div>
<div itemid="1236">Chicken curry</div>
Here is the data island in json:
{
head:{
title:'',
source:'',
version:''
},
items:[
{
id:'1234',
type:'recipe',
title:'Chicken marsala',
ingredients:'here...'
},
{
id:'1235',
type:'recipe',
title:'Fried chicken',
ingredients:'here...'
}
]
}
Here is the data island in xml:
<data>
<head>
<title>here</title>
<source></source>
<version></version>
</head>
<items>
<item id="1234" type="recipe">
<title>chicken marsala</title>
<ingredients>here...</ingredients>
</item>
<item id="1235" type="recipe">
<title>fried chicken</title>
<ingredients>here...</ingredients>
</item>
</items>
</data>
- ericmoritz 15y agoactually that's what rel="alternative" is used for; an alternative representation of the current page. You something like this could be done: <link rel="alternative" type="application/event+json" href="http://example.com/events/2010/06/03/schweet.json" />
- ericmoritz 15y agoActually after reading the microdata spec, there's a application/microdata+json format that would probably work better: http://dev.w3.org/html5/md/#application-microdata-json http://dev.w3.org/html5/md/#application-microdata-json So you'd have an alternative resource <link rel="alternative" type="application/microdata+json" href="http://dev.w3.org/html5/md/#application-microdata-json" /> That file would look like this: { "items": [ { "id": "http://example.com/events/2010/06/03/schweet", "type": "http://schema.org/Event", "properties": { "startDate": ["2010-06-03"], "location": [{ "id": "http://example.com/places/my-crib", "type": "http://schmea.org/Place", "properties": { "url": ["http://example.com/places/my-crib"], "address": [{ "type": "http://schema.org/PostalAddress", "properites": { "addressLocality": "Knoxville", "addressRegion": "TN" } }] } }] } } ] } Who knows if Google will actually use that file though.