Branding with confidence

From EPrints Documentation
Revision as of 15:32, 15 January 2007 by Tmb (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

One of the most common EPrints customisations is to add your own institution's branding and "look or feel" - logos, page layouts, stylesheets and colour schemes.

Branding fast track

This section describes techniques for very quickly changing the appearance of your EPrints repository. These techniques could be useful, for example, to quickly brand a demonstration repository so that your audience can identify with it.

Example 1

The simplest approach is to overwrite the default EPrints logo with a copy of your own logo. Copy your logo to:

/opt/eprints3/archives/ARCHIVEID/cfg/static/images/sitelogo.gif

Reload the EPrints configuration by typing:

bin/epadmin reload ARCHIVEID

Your logo should now be displayed in place of the default EPrints logo.

Example 2

The image that EPrints uses for the site logo is defined in the branding configuration file. You can change this setting to point the logo image on your institution's Web page.

Open the branding configuration file in a text editor:

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

Find the site_logo configuration setting:

$c->{site_logo} = "/images/sitelogo.gif";

Change the setting to point to your own logo image:

$c->{site_logo} = "http://www.soton.ac.uk/img/furniture/royal/corp_logo.gif";

Reload the EPrints configuration by typing:

bin/epadmin reload ARCHIVEID

Example 3

You can also adjust the site_logo configuration setting to point any local image file. Place a copy of your logo image somewhere in the /opt/eprints3/archives/ARCHIVEID/cfg/static/images/ directory and then update the branding configuration file to point to it.

$c->{site_logo} = "/images/local/mylogo.gif";

Reload the EPrints configuration by typing:

bin/epadmin reload ARCHIVEID

This time, an extra step is needed to process the new logo file:

bin/generate_static ARCHIVEID

Themes

Open the branding configuration file in a text editor:

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

Find the theme configuration setting:

# $c->{theme} = "green";

Change the setting to use a theme.

$c->{theme} = "green";

Currently EPrints 3 only includes the "green" theme, but look out for more themes in future versions of EPrints and on the http://files.eprints.org/ community repository

Advanced Branding

Changing the site template

You can achieve much more radical changes to the layout of the site but editing the site template directly.

Open the site template for your repository:

/opt/eprints3/archives/ARCHIVEID/cfg/lang/en/templates/default.xml

This is an XHTML file with some special extras that we need to understand before continuing.

Pins

You will notice a number of epc:pin elements. These tell EPrints how to the template combines with page-specific content to build individual repository pages.

<epc:pin ref="title"/> where the title of the page should be inserted <epc:pin ref="page"/> where the main content of the page should be inserted <epc:pin ref="toolbar" /> where the toolbar (what is the toolbar) should be inserted <epc:pin ref="login_status"/> the login status of the current user

You can incorporate these however you like into your new layout.

There are a couple of pins which have a more fixed position:

<epc:pin ref="head"/> inside the head element of the template <epc:pin ref="pagetop"/> the top of the page - this is usually the first element inside the body

You can also define new pins (see below).

Config Strings

To avoid having to hardcode URLs (and possibly other data) into your template, EPrints provides a useful mechanism for including configuration strings. This means that when the URLs change, you do not have to change the template.

Example:

<a href="{$config{frontpage}}"><img alt="Logo" src="{$config{site_logo}}" /></a>

This is the site logo (see above) wrapped in a link to the front page of the repository.

To include a config string outside of an attribute, need to use epc:print :

<style type="text/css" media="screen">@import url(<epc:print expr="$config{base_url}"/>/style/auto.css);</style>

This is from the head section of the default template, and loads the auto.css stylesheet (see below).

Adding more images

Put the images in /opt/eprints3/archives/devel/cfg/static/images/

Then run generate_static

Can then be referred to from the site template eg.

<img src="/images/footer.png" />

Working with stylesheets

style-related images

Dynamic templates

Add date_time pin.

Guidelines for a major template overhaul

1 Design site layout, with logos etc. eg. take a candidate page from an existing site Make XHTML - tidy might help 2 Replace content with appropriate epc:pin elements 3 Add images and stylesheets to static dir