====== 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/sites'' folder, create a new folder. Whatever you name this folder will be the name of your new site. For this example, it is called ''secondsite''.
* Copy the ''siteConfig.xml'' file from ''Greenstone3/web/sites/localsite'' into this new ''secondsite'' folder.
* //**Optional:** Modify this file to change the configuration for your new site.//
* In ''secondsite'', create a folder called ''collect''.
* //**Optional:** Move/copy any collections from ''localsite/collect'' into ''secondsite/collect'' for 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:
newservlet
This is my new servlet, which is using my new site!
org.greenstone.gsdl3.LibraryServlet
library_name
anotherlibrary
site_name
secondsite
interface_name
default
receptionist_class
DefaultReceptionist
default_lang
en
//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:
newservlet
/anotherlibrary/*
//Notice that the ''servlet-name'' is the same here as above, and the ''url-pattern'' is the same as
the ''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.