Adding new views

From EPrints Documentation
Revision as of 17:23, 1 February 2007 by Tmb (Talk | contribs)

Jump to: navigation, search

Browse views provide a way for visitors to your site to discover relevant content without a specific item in mind (for example, browsing all the content associated with a particular topic). Visitors arriving directly at the page for a specific item in the repository (for example, via a search engine) may also use the views to discover other related content. There are two default views in EPrints - By Year and By Subject. This guide describes how to add additional views to your repository.

Adding a new view

This section describes how to quickly add a new view to your repository.

Open the views configuration file in a text editor:

/opt/eprints3/archives/ARCHIVEID/cfg/cfg.d/views.pl

Find the browse_views configuration setting:

$c->{browse_views} = [
       {
               id => "year",
               ...
       },
       {
               id => "subjects",
               ...
       },
];

Each view is defined using a special (Perl*) syntax: the view definition consists of a pair of curly braces (note the comma after each closing brace) enclosing a list of property/value pairs (note the comma after each line).

  • Those familiar with Perl will recognise the browse_views setting as a reference to an array of hash references.

Example 1 Browse by organisational structure

By default, EPrints has a divisions metadata field which allows authors to associate their deposits with the divisions (units, faculties, schools, departments, institute, centre..) that were involved in producing their item (for example, the author's department, and the departments of his co-authors). To allow visitors to the repository to browse the content by division, add the following definition to the browse_views setting:

$c->{browse_views} = [
       {
               id => "year",
               ...
       },
       {
               id => "subjects",
               ...
       },
       {
               id => "divisions",
               fields => "divisions",
               order => "-date/title",
               hideempty => 1,
       },
];

Example 2 Browse by type

Every deposit in EPrints has a type (article, book, thesis...). To allow visitors to browse your repository content by type, add the following definition to the browse_views setting:

{
       id => "types",
       fields => "type",
       order => "-date/title",
       hideempty => 1,
},

After adding a new view definition, save the file generate the new view pages:

bin/generate_views ARCHIVEID --verbose

(this will also re-generate any existing views defined in the views configuration file).

Testing new views

Warning message when running generate_views:

Undefined phrase: "viewname_eprint_divisions" (en)

On the webpage:

["viewname_eprint_divisions" not defined]

Edit the language-specific phrases file for view names:

/opt/eprints3/archives/devel/cfg/lang/en/phrases/views.xml

Add an appropriate phrase which describes your new view, for example:

<epp:phrase id="viewname_eprint_divisions">Division</epp:phrase>

Complex views

Division->Author

Journal->ISSN


Linking items back to views

Views as collections

discover related content

There are two ways in which visitors to your repository may discover relevant content - searching

Visitors to your repository can take advantage
https://wiki.eprints.org/w/index.php?title=Adding_new_views&direction=next&oldid=3799
wiki.eprints.org
crawl=CC-MAIN-2019-39
20932
application/http; msgtype=response
sha1:IKB3TFG7VQIZQ3X7G5U2WZMLHKAJLWMP
<urn:uuid:6a086033-c0ff-4a8c-a72e-5a468a5d3c26>
2019-09-15T20:01:39Z
46.22.140.106
text/html
sha1:EFTSMPEAS3RXTGNYQXTRPQ5OCD6LAPM5
<urn:uuid:cc8c9347-c6a2-4891-a16b-06b1a18a75bd>
https://wiki.eprints.org/w/index.php?title=Adding_new_views&direction=next&oldid=3799
response
<urn:uuid:56b394db-1850-4249-adeb-f6d24f2b7dd2>
isPartOf: CC-MAIN-2019-39
publisher: Common Crawl
description: Wide crawl of the web for September 2019
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-47.ec2.internal
software: Apache Nutch 1.15 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.1-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/