Taxonomy Plugin Delivery Tier Configuration - BloomReach Experience - Open Source CMS

This article covers a Hippo CMS version 10. There's an updated version available that covers our most recent release.

07-03-2016

Taxonomy Plugin Delivery Tier Configuration

HST Configuration

After adding and configuring the Taxonomy plugin using the setup application, you will need to tell Spring to create a TaxonomyManager component. An example for a configuration can be found in the taxonomy-demo: taxonomy.xml

Copy this file into META-INF/hst-assembly/overrides in your project's site module.

If you do not have the following context parameters in your WEB-INF/web.xml you should add these.

  <context-param>
    <param-name>hst-beans-annotated-classes</param-name>
    <param-value>classpath*:org/example/beans/**/*.class
      ,classpath*:org/onehippo/forge/**/*.class</param-value>
  </context-param>    

Using Taxonomies in HST

Now, you are ready to use the taxonomy from within HST components. After retrieving the TaxonomyManager bean you can simply ask it for a taxonomy:

  import org.onehippo.taxonomy.api.Taxonomy;
  import org.onehippo.taxonomy.api.TaxonomyManager;

  ...
  TaxonomyManager taxonomyManager = HstServices.getComponentManager().getComponent(TaxonomyManager.class.getName());
  Taxonomy taxonomy = taxonomyManager.getTaxonomies().getTaxonomy("exampletaxonomy");

where exampletaxonomy is the name of the taxonomy, which is in fact the name of the root node of the taxonomy.

The taxonomy demo shows several ways to use a Taxonomy from within the frontend: to search for a taxonomy value, to generate the full taxonomy tree and to locate an entry. Enough to get you going.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?