Last active
April 25, 2018 08:38
-
-
Save Reedyn/5baad81436e08dcdc55c to your computer and use it in GitHub Desktop.
JSON-LD implementation for Jönköping University Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="jul-jsonld"> | |
var jsonld = { | |
"@context": "http://schema.org", | |
"@id": "http://ju.se/bibliotek", | |
"@type": "Library", | |
"name": "Högskolebiblioteket i Jönköping", | |
"alternateName": "Jönköping University Library", | |
"address": { | |
"streetAddress": "Gjuterigatan 5", | |
"addressLocality": "Jönköping", | |
"postalCode": "55318", | |
"addressCountry": "Sweden" | |
}, | |
"geo": { | |
"@type": "GeoCoordinates", | |
"latitude": "57.7793598", | |
"longitude": "14.1620846" | |
}, | |
"telephone": "+46 36 10 10 10", | |
"email": "biblioteket@ju.se", | |
"openingHoursSpecification": {} | |
}; | |
var script = $('<script>'); | |
script.attr('type','application/ld+json'); | |
// Grab Opening Hours from LibCal's API | |
$.ajax({ | |
url: 'http://api3.libcal.com/api_hours_grid.php?format=jsonld&iid=3237&lid=1884&callback=jsonld', | |
jsonpCallback: "jsonld", | |
dataType: "jsonp" | |
}).then(function(data){ | |
// Add Opening Hours from LibCal to our JSON-LD object | |
jsonld.openingHoursSpecification = data.openingHoursSpecification; | |
script.html(JSON.stringify(jsonld)); | |
// Append the JSON-LD element to body | |
$('body').append(script); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hej!
Fungerar detta bra för ert bibliotek?
Dvs konsumerar google json-ld och visar öppettiderna korrekt?
/Fredrik -Uppsala Universitetsbibliotek