From b00c1d4e6b69e670ddda220b23a1b408e5e46849 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Thu, 22 Aug 2013 07:00:12 -0400 Subject: [PATCH] Bug 6594: Schema.org structured data for OPAC display To support schema.org processors, such as Google, Bing, and Yandex, structure our data so that it has machine-readable attributes. This pass declares the CreativeWork sub-types as well as Product for the main bibliographic record details, and uses the Offer type for holdings information per the W3C Schema Bib Extend community group discussions. Signed-off-by: Dan Scott Signed-off-by: Jared Camins-Esakov Comments on final patch. --- .../prog/en/includes/item-status-schema-org.inc | 11 +++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 18 ++--- .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 71 ++++++++++++++++---- 3 files changed, 78 insertions(+), 22 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/item-status-schema-org.inc diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/item-status-schema-org.inc b/koha-tmpl/opac-tmpl/prog/en/includes/item-status-schema-org.inc new file mode 100644 index 0000000..6f1acc8 --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/includes/item-status-schema-org.inc @@ -0,0 +1,11 @@ +[% USE KohaAuthorisedValues %] + +[% IF ( item.damaged or item.datedue or item.itemlost or item.transfertwhen or item.waiting ) %] + +[% ELSIF ( item.wthdrawn ) %] + +[% ELSIF ( item.itemnotforloan or item.notforloan_per_itemtype ) %] + +[% ELSE %] + +[% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 77a62f0..cc05199 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -1511,9 +1511,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( ShowCourseReservesHeader ) %]Course reserves[% END %] [% FOREACH ITEM_RESULT IN items %] - [% IF ITEM_RESULT.this_branch %][% ELSE %][% END %] + [% IF ( item_level_itypes ) %][% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %][% ITEM_RESULT.description %][% END %][% END %] [% ITEM_RESULT.description %][% END %] - + + + [% UNLESS ( singleBranchMode ) %]
[% IF ( ITEM_RESULT.branchurl ) %] @@ -1527,23 +1529,23 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% ITEM_RESULT.location_description %] [% IF ( itemdata_ccode ) %][% ITEM_RESULT.ccode %][% END %] - [% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (Browse shelf)[% END %][% END %] + [% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (Browse shelf)[% END %][% END %] [% IF ( itemdata_enumchron ) %][% ITEM_RESULT.enumchron %][% END %] [% IF ( itemdata_uri ) %] [% IF ITEM_RESULT.uri %] [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - Link to resource + Link to resource [% ELSE %] - [% ITEM_RESULT.uri %] + [% ITEM_RESULT.uri %] [% END %] [% END %] [% END %] [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber %][% END %] - [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] - [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] + [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] + [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] [% ITEM_RESULT.datedue | $KohaDates %] - [% IF ( OPACShowBarcode ) %][% ITEM_RESULT.barcode %][% END %] + [% IF ( OPACShowBarcode ) %][% ITEM_RESULT.barcode %][% END %] [% IF holds_count.defined || show_priority %] [% IF holds_count.defined %] [% ITEM_RESULT.holds_count %] [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl index ad74c53..6499927 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -8,6 +8,7 @@ exclude-result-prefixes="marc items"> + @@ -91,10 +92,27 @@ + + + + Book + Map + MusicAlbum + CreativeWork + + + + + + record + http://schema.org/ + Product + #record + -

+

245 abhfgknps @@ -103,7 +121,7 @@ -

+

a @@ -141,7 +159,7 @@ -
by +
by @@ -308,28 +326,38 @@ Publisher: + + a + + b + + - - - - cg - - - - ; + + + + + + cg + + + + + + ; @@ -347,6 +375,7 @@ Edition: + @@ -354,6 +383,7 @@ + .; @@ -372,6 +402,7 @@ Description: + @@ -379,6 +410,7 @@ + .; @@ -387,9 +419,11 @@ ISBN: + .; + @@ -441,6 +475,7 @@ Other title: + @@ -448,6 +483,7 @@ + .; @@ -457,6 +493,7 @@ Title translated: + @@ -464,6 +501,7 @@ + .; @@ -471,17 +509,20 @@ + 130,240 adfklmor results_summary uniform_title Uniform titles: + Uniform titles: + @@ -496,6 +537,7 @@ + .; @@ -504,7 +546,7 @@ Subject(s): - + /cgi-bin/koha/opac-search.pl?q=an: @@ -552,7 +594,7 @@ Online resources: - + /cgi-bin/koha/tracklinks.pl?uri=;biblionumber= @@ -628,7 +670,7 @@ -
+
@@ -939,6 +981,7 @@ + -- 1.7.9.5