You are previewing Maven: The Definitive Guide.

Maven: The Definitive Guide

Cover of Maven: The Definitive Guide by Sonatype Company Published by O'Reilly Media, Inc.
O'Reilly logo

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 explain. This ...

The best content for your career. Discover unlimited learning on demand for around $1/day.