EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #07723
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Open graph Tags
- To: James Kerwin <jkerwin2101@gmail.com>, "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] Open graph Tags
- From: John Salter <J.Salter@leeds.ac.uk>
- Date: Fri, 1 Mar 2019 14:21:50 +0000
Hi James, The page I linked to is useful for static pages. It also mentions 'dynamic pins', but doesn't really give much explanation. For abstract pages, take a look at: ~/archives/[ARCHIVEID]/cfg/cfg/eprint_render.pl, specifically (towards the end): my $links = $repository->xml()->create_document_fragment(); if( !$preview ) { $links->appendChild( $repository->plugin( "Export::Simple" )->dataobj_to_html_header( $eprint ) ); $links->appendChild( $repository->plugin( "Export::DC" )->dataobj_to_html_header( $eprint ) ); } For your purposes, the 'proper' solution would be to create an export format for 'TwitterCard', and implement something very similar
to the dataobj_to_html_header methods in Export::DC or Export::Simple. Then, update the code above, regenerate an abstract to test, and hopefully away you go! (Then, if you get it all working, and think it might be useful to other EPrints sites, stick the code on GitHub, package it for the
Bazaar, and release it! :o) Cheers, John NB Depending on what extensions you have installed in your repository, the 'render_eprint' function may be redefined in a later config
file… From: James Kerwin [mailto:jkerwin2101@gmail.com]
Hi John, Thanks for the tip. I've been looking at that page this morning since my hacky way of getting the tags to work has come back to bite me. Ultimately, I had to go to "Facebook for Developers" and clear the cache and "scrape" the repository again (it hadn't been done since the start of Feb). The reason the abstracts were working is because they had never been scraped so loaded
up my new tags without using the cache. It appears just putting them in the default.xml template was enough. Now I'm having fun with "Twitter Cards" - the Twitter equivalent to og tags. Unfortunately, I think I need to take a step back and add these tags to the <head> in a different way as in each case the tags need access to variables such as
EPrint titles, abstracts etc. I'll get there in the end. Thanks for you help, James On Thu, Feb 28, 2019 at 4:51 PM John Salter via Eprints-tech <eprints-tech@ecs.soton.ac.uk> wrote:
|
- Follow-Ups:
- Re: [EP-tech] Open graph Tags
- From: John Salter <J.Salter@leeds.ac.uk>
- Re: [EP-tech] Open graph Tags
- References:
- [EP-tech] Open graph Tags
- From: James Kerwin <jkerwin2101@gmail.com>
- Re: [EP-tech] Open graph Tags
- From: John Salter <J.Salter@leeds.ac.uk>
- Re: [EP-tech] Open graph Tags
- From: James Kerwin <jkerwin2101@gmail.com>
- Re: [EP-tech] Open graph Tags
- From: John Salter <J.Salter@leeds.ac.uk>
- [EP-tech] Open graph Tags
- Prev by Date: Re: [EP-tech] Open graph Tags
- Next by Date: [EP-tech] Antwort: Open graph Tags
- Previous by thread: [EP-tech] EPrints/CRIS
- Next by thread: [EP-tech] DOI handling in orcid_support_advance
- Index(es):