Greenstone 3 Sites
In Greenstone3, sites hold all of the content of your digital library. They are basically collections of collections, and your Greenstone installation can have multiple sites.
By default, the site homepage links to all of the collections in the site. So, if you have multiple sites, only the collections within each site will appear on their respective homepages.
Why would you want multiple sites? Sites provide another layer of organization. Perhaps you want one site that houses all of your image collections, another all of your pdf collections, and another for all of your multimedia collections. Or, perhaps you want to separate your collections based on topics. You could (technically) even have a separate site for each collection (this may not be particularly useful, but is possible).
You may not need to use multiple sites, but, if you do, the functionality is there.
Create a new site
To create a new site in Greenstone3:
- In the
Greenstone3/web/sitesfolder, create a new folder. Whatever you name this folder will be the name of your new site. For this example, it is called
- Copy the
Greenstone3/web/sites/localsiteinto this new
- Optional: Modify this file to change the configuration for your new site.
secondsite, create a folder called
- Optional: Move/copy any collections from
secondsite/collectfor these collections to be in your new site
Use a new site
So, you've created a new site, but now what? Remember, the sites in Greenstone are just content. They contain collections, which, in turn, contain documents and all of the metadata, indexes, and configurations you have specified. (Ok, if we're being completely accurate, sites and collections can potentially have their own presentation information, as well, but let's ignore that for a moment.)
So you are still missing two things: presentation – how the site will be displayed in the browser – and location – where the site will be located, i.e. the URL. These are separate from the site for a reason: you may want to present the same content in different ways (e.g. normal and mobile sites ) or different content in the same – or a similar – way.
To do this, we need to define one or more servlets that use our new site.
Servlets are defined in
Greenstone3/web/WEB-INF/web.xml. Simply add another servlet:
<servlet> <servlet-name>newservlet</servlet-name> <description>This is my new servlet, which is using my new site!</description> <servlet-class>org.greenstone.gsdl3.LibraryServlet</servlet-class> <init-param> <param-name>library_name</param-name> <param-value>anotherlibrary</param-value> </init-param> <init-param> <param-name>site_name</param-name> <param-value>secondsite</param-value> </init-param> <init-param> <param-name>interface_name</param-name> <param-value>default</param-value> </init-param> <init-param> <param-name>receptionist_class</param-name> <param-value>DefaultReceptionist</param-value> </init-param> <init-param> <param-name>default_lang</param-name> <param-value>en</param-value> </init-param> </servlet>
For more information about these parameters, see the web services page. The important
one here is the
site_name, which you can see has the value
secondsite, the name of our new site.
Then, near the bottom of the
web.xml file, add a new servlet mapping, defining the URL for the new servlet:
<servlet-mapping> <servlet-name>newservlet</servlet-name> <url-pattern>/anotherlibrary/*</url-pattern> </servlet-mapping>
Notice that the
servlet-name is the same here as above, and the
url-pattern is the same as
library_name from above. These must match in this way. The web services page explains why.
Now, if you start (or restart) your Greenstone3 server, and navigate to
http://localhost:8383/greenstone3/anotherlibrary you will arrive at the home page of
your new library, using the
default interface to display your newly created site.