Koha How-To

Make your "OPAC View" link in Koha work with Aspen

This is a little trick for libraries using Aspen as a discovery layer and Koha as a backend. In the Koha staff client you may be familiar with a button on the record detail page that says: “OPAC view: Open in a new window”. This whisks you away to the corresponding record in the Koha OPAC. If you are now using Aspen that would be a bit confusing for staff!

Luckily, we can add some very simple jQuery to the Koha system preference ‘IntranetUserJS’ that can solve this problem and redirect you to the correct Aspen page instead! Here it is:

if ( $('#catalog_detail').length ) {
 let baseURL = 'https://aspen-model.bywatersolutions.com';
 
 let bib = $('input[name="bib"]').val()
 $('.results_summary > a:contains("Open in new window")').attr('href' , `${baseURL}/Record/${bib}`) 
}

To make this work for you you only have to edit one line of this jQuery:

let baseURL = 'https://aspen-model.bywatersolutions.com';

Just set the base URL to your own Aspen instance and the ‘Open in a new window’ button should now take you to the proper record in Aspen instead of Koha!

Read more by Lucas Gass

Tags Aspen Discovery