LP#1710747: Absolute URL for Open Graph image property user/kmlussier/lp1710747-open-graph-image-absolute-url
authorKathy Lussier <klussier@masslnc.org>
Tue, 15 Aug 2017 02:13:31 +0000 (22:13 -0400)
committerKathy Lussier <klussier@masslnc.org>
Tue, 15 Aug 2017 02:13:31 +0000 (22:13 -0400)
The Open Graph image property requires the full absolute URL rather than the
relative URL that was previously used on the record summary page.

Test Plan:
Pre-patch - Visit a record summary page in the catalog. View the source of the
page. In the head section, find the og:image meta property. The content will
display a relative URL to the record's book jacket cover image.

Post-patch - When viewing the source of the page, og:image will display the
full URL.

Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/opac/parts/record/summary.tt2

index 42835fd..57a312c 100644 (file)
@@ -1,8 +1,9 @@
-[%  PROCESS "opac/parts/misc_util.tt2";
+[%-  PROCESS "opac/parts/misc_util.tt2";
     USE ResolverResolver;
-    ctx.page_title = attrs.title | html
-    ctx.metalinks.push('<meta property="og:image" content="' _ ctx.media_prefix _ '/opac/extras/ac/jacket/large/r/' _ ctx.bre_id _ '" />');
-%]
+    ctx.page_title = attrs.title | html;
+    full_image_path = ctx.proto _ '://' _ ctx.hostname _ '/opac/extras/ac/jacket/' _ record.summary.jacket_size _ '/r/' _ ctx.bre_id;
+    ctx.metalinks.push('<meta property="og:image" content="' _ full_image_path _ '" />');
+-%]
 <!-- ****************** rdetail_summary.xml ***************************** -->
 <abbr class="unapi-id" title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% ctx.bre_id %]'></abbr>