Customizing the Site Descriptor

When you add content to the site, you are going to want to modify the lefthand navigation menu that is generated with your site. The site descriptor shown in Example 15-1 customizes the logo in the upper-lefthand corner of the site. In addition to customizing the header of the site, this descriptor adds a menu section to the lefthand navigation menu under the heading “Sample Project.” This menu contains a single link to an overview page.

Example 15-1. An initial site descriptor

<project name="Sample Project">
  <bannerLeft>
    <name>Sonatype</name>
    <src>images/logo.png</src>
    <href>http://www.sonatype.com</href>
  </bannerLeft>
  <body>
    <menu name="Sample Project">
      <item name="Overview" href="index.html"/>      
    </menu>
    <menu ref="reports"/>
  </body>
</project>

This site descriptor references one image. This logo.png image should be placed in ${basedir}/src/site/resources/images. In addition to the change to the site descriptor, you’ll want to create a simple index.apt page in ${basedir}/src/site/apt. Put the following content in index.apt; it will be transformed to the index.html and serve as the first page a user sees when they come to your project’s Maven-generated web site:

 Welcome to the Sample Project, we hope you enjoy your time on this project site. We've tried to assemble some great user documentation and developer information, and we're really excited that you've taken the time to visit this site. What is Sample Project Well, it's easy enough to ...

Get Maven: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.