HathiTrust Availability


Paul Ojennus, Whitworth University


Adds a link in the Primo brief results tile when item is available from HathiTrust; the link resolves to the item in HathiTrust. Libraries may customize the behavior based on local holdings, material type and copyright status. Partner institutions may include automatic login information. This is an adaptation of the UMNLibraries version at https://github.com/UMNLibraries/primo-explore-hathitrust-availability

Brief record of a book in Primo with the HathiTrust link below the call number.

System Components

Alma Discovery Package Manager

Skillset Requirements

Alma Discovery, JS, CSS


Tested for keyboard navigation, NVDA reads aria labels correctly

Browser Support

Tested on Chrome, Edge, Firefox, and Safari

Mobile Support

Tested on Android and iPhone



To enable this module, you will need to:

  • Declare the module (Step 2)
  • Insert a declaration to hold the code from the Central Package (Step 3)


  1. Turn on inheritance from the Central Package.
  2. In your local package, in the custom.js file, include the module ‘hathiTrustAvailability’ in your app definition. For example:

    var app = angular.module('viewCustom',   ['hathiTrustAvailability']);

    If you are using other angular modules, include them in your app definition as well. For example:

    var app = angular.module('viewCustom', ['hathiTrustAvailability', 'oadoi']);
  3. Also in the custom.js file, add the following line of code within the anonymous function (that is, before the closing brackets at the end of the file):

    app.component('prmSearchResultAvailabilityLineAfter', { template: '<hathi-trust-availability></hathi-trust-availability>' });
  4. Optional: include the following block of code to customize the options:

    app.value('hathiTrustAvailabilityOptions', {
    msg: 'Full Text Available at HathiTrust',
    hideOnline: false,
    hideIfJournal: false,
    ignoreCopyright: false,
    entityId: '',
    excludeNotLocal: true

  5. Values may be customized as follows:
    1. msg: The text value you want for the link. Default value is ‘Full Text Available at HathiTrust’
    2. hideOnline: set to true to hide the link if services are available; set to false to always show the link. Default value is false.
    3. hideIfJournal: set to true to hide if the resource type is “journal”; set to false to always show the link. Default value is false.
    4. ignore Copyright: set to false to show only freely available items; set to true always show the link. Default value is false.
    5. entityId: If you are a member institution, you may enter your Entity ID here to enable automatic authentication. Default value is ‘’ (null).
    6. excludeNotLocal: set to true to show only items associated with your institution; set to false to always show the link. Default value is true.
  6. Optional: add custom styling to the link. Copy the following code into your custom1.css and adjust the styles to match your branding:

    span.umnHathiTrustLink {
      margin-left: -5px;

    span.umnHathiTrustLink md-icon svg {
      height: 1.2em;
      filter: grayscale(100%);

    span.umnHathiTrustLink:hover md-icon svg {
      filter: grayscale(0%);
  7. Zip and upload your package in Alma Discovery. Save your view.