Fix schema.org mapping for MusicAlbum, add Map
authorDan Scott <dscott@laurentian.ca>
Fri, 5 Apr 2013 17:21:47 +0000 (13:21 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 18 Apr 2013 19:18:05 +0000 (15:18 -0400)
We had set LDR[06] = j to MusicRecording, but that is really meant for
individual songs. Use MusicAlbum instead, and per
http://schema.org/MusicAlbum, use a new MusicGroup itemtype with a
'byArtist' property for the primary artist rather than the generic
'accountablePerson'.

Also map LDR[06] = e to Map, because that seems like a safe bet.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/templates/opac/parts/misc_util.tt2
Open-ILS/src/templates/opac/parts/record/authors.tt2

index bddab42..fa3ed90 100644 (file)
@@ -88,7 +88,8 @@
         args.schema.itemtype = {};
         schema_typemap = {};
         schema_typemap.a = 'http://schema.org/Book';
-        schema_typemap.j = 'http://schema.org/MusicRecording';
+        schema_typemap.e = 'http://schema.org/Map';
+        schema_typemap.j = 'http://schema.org/MusicAlbum';
 
         args.isbns = [];
         FOR isbn IN xml.findnodes('//*[@tag="020"]/*[@code="a"]');
index b52aea3..43a3060 100644 (file)
@@ -54,11 +54,19 @@ BLOCK build_author_links;
         
         # schema.org changes
         IF type == 'author';
-            iprop = ' itemprop="accountablePerson"';
+            IF args.schema.itemtype && args.schema.itemtype.match('MusicAlbum');
+                iprop = ' itemtype="http://schema.org/MusicGroup" itemscope itemprop="byArtist"';
+            ELSE;
+                iprop = ' itemprop="accountablePerson"';
+            END;
         ELSIF type == 'added';
             iprop = ' itemprop="contributor"';
         END;
-        '<a href="' _ url _ '"' _ iprop _ '>' _ term.replace('^\s+', '') _ '</a>';
+        '<a href="' _ url _ '"' _ iprop _ '>';
+        IF iprop; '<span itemprop="name">'; END;
+        term.replace('^\s+', '');
+        IF iprop; '</span>'; END;
+        '</a>';
         FOREACH link880 IN graphics;
             diratt = '';
             IF link880.dir;