Hippo Tip: New Agenda Item in Left Sidebar
By Geertjan-Oracle on Jul 13, 2011
Let's add a new item in the left sidebar of a Hippo application... for our site's agenda items. It's slightly tricky since you don't simply want to add a new link to a page. Instead, you want to add new metadata and content into the JSR 283 repo that is beneath Hippo. So, there's the default website that the Hippo Maven archetype gives you (the "site" module):
...and what we want to achieve in this blog entry is to have a new item "agenda" right below "news":
This is how to achieve the above, assuming your Hippo project is named "CarSalesSite":
- In your "site" module's source code, there's a "beans" package in "src". Copy "NewsDocument.java" and name it "AgendaDocument.java". Inside this document, change "CarSalesSite:newsdocument" to "CarSalesSite:agendadocument".
- In the Hippo CMS, go to "Configuration", copy "newsdocument" and name it "agendadocument". Now commit the new document type.
- In the Hippo CMS, go to "Documents", and create a new "translated folder" on the same level as "Common" and "News". Name that new folder "Agenda". Within that folder, create another folder, named "2011". Within that folder, publish one or two documents of your new "agendadocument" type.
- Now go to the CMS Console. In "hst:hst/hst:configurations/CarSalesSite/hst:sitemenus/main", copy "news" and name it "agenda". Within "agenda", change the value of "hst:referencesitemapitem" to "agenda".
- In "hst:hst/hst:configurations/CarSalesSite/hst:sitemap", copy the "news" folder and name it "agenda". On the level of the folder, as well as the files, change the value of "hst:relativecontentpath" to "agenda". Write the changes to the repository.
Now you'll need to undeploy the "site" module, rebuild it, and run the application again from scratch, since you have a new bean in it, unless you're using some kind of automatic refresh functionality, such as is available natively in NetBeans IDE, also for Maven projects.