Kia ora koutou,
Has anyone played around with Twitter cards and/or Open Graph with Dspace? The goal being that, if someone tweets a link to an item in the repository, Twitter (or Facebook or whoever) automatically displays a little preview of the item’s title, thumbnail etc. This seems likely to improve click-throughs/engagement.
I’ve edited page-structure.xsl (we’re on XMLUI, Mirage2) to get some basic metadata in – following the Google Scholar Metadata section:
<!-- Add Open Graph tags for appearance on social media -->
<meta property="og:type" content="article"/>
<meta property="og:site_name" content="Research@Lincoln"/>
<meta property="og:image" content="https://ltl.lincoln.ac.nz/wp-content/uploads/sites/20/2020/01/lincoln.png"/>
<xsl:for-each select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element = 'title']">
<meta property="og:title" content="{.}"/>
</xsl:for-each>
<xsl:for-each select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element = 'identifier']">
<meta property="og:url" content="https://hdl.handle.net/{.}"/>
</xsl:for-each>
Which experiments on Twitter show works! J
But note the image is a static logo, and I haven’t managed to get a description in. This content doesn’t appear to be included in the dri structure – except that dcterms.abstract is buried in the xhtml_head_item which is a giant blob-thing of xml as text so I can’t reach into it (unless maybe I play with substrings). Is there any other way to get at the abstract here?
And is there a way to access the mets data from page-structure.xsl? (If so, I should be able to get the item’s thumbnail to use for the image.) We have in item-view.xsl and I don’t see why it wouldn’t be accessible from page-structure.xsl, but maybe that shows how much I know. In any case so far all my trial-and-error messing around trying to access it has resulted in errors.
Ngā mihi,
Deborah
––––––––––––––––––––––––––––––––––
Deborah Fitchett
Head of Department: Digital Services
––––––––––––––––––––––––––––––––––
Library, Teaching and Learning – Te Wharepūrākau
PO Box 85064, Lincoln University
Lincoln 7647, Christchurch, New Zealand
––––––––––––––––––––––––––––––––––
Lincoln University
Te Whare Wānaka o Aoraki
––––––––––––––––––––––––––––––––––
--
All messages to this mailing list should adhere to the DuraSpace Code of Conduct: https://duraspace.org/about/policies/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/SYCPR01MB475232A846F2EC2145DBA051C5180%40SYCPR01MB4752.ausprd01.prod.outlook.com.
Thanks! Do let me know if you figure out a way to get at the thumbnail and/or abstract data.
Note, as far as I can tell the Twitter Card validator only works if there’s an actual twitter:card tag, which I haven’t included in my code below; but the card seems to display on Twitter without it.
It also works on LinkedIn – except that they’ve got a minimum image size requirement [https://www.linkedin.com/help/linkedin/answer/46687/making-your-website-shareable-on-linkedin?lang=en], so a mere logo isn’t displayed.
I haven’t yet tested Facebook.
Deborah