Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

This is pre-release information related to Avalon R3

Avalon provides hooks that Avalon includes hooks to allow institutions to define permalinks (e.g., using a Handle server, DOI, or other durable link generating system) to for resources. These links show up on the item /preview view page in the Share this resource tab.

Permalinks are generated only for published Media Objects. When a Media Object is published, or a published Media Object is modified, Avalon makes sure that a permalink exists for the Media Object (Item) and for each of its Master Files (tracks, sections, etc.component files (Sections).

To define how permalinks are generated, create a file in config/initializers (e.g., config/initializers/generate_permalink.rb) following this template:

Code Block
languageruby
linenumberstrue
Permalink.on_generate do |obj,url_for_obj|
  # Create a permanent link resource that will resolve/redirect toto 
obj  # #url_for_obj and return that resource as a URL string. e.g., 
  return "http://permalinkresolver.example.edu/media/#{obj.pid}"
end

To create permalinks for Media Objects (Items) only, and not direct links to sections:

Code Block
languageruby
linenumberstrue
Permalink.on_generate do |obj,url_for_obj|
  if obj.is_a? MediaObject
    return "http://permalinkresolver.example.edu/media/#{obj.pid}"
  else
    return nil
  end
end


It's also possible to use a generic route for permalinks.  The pid for an object can be substituted into the object controller route (i.e. /object/avalon:1).  The controller will redirect the browser to the resource.

Code Block
languageruby
linenumberstrue
Permalink.on_generate do |obj,url_for_obj|
  if obj.is_a? MediaObject
    return "http://permalinkresolver.example.edu/object/#{obj.pid}"
  else
    return nil
  end
end