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

Tips and Tricks

This section lists some useful tips and tricks you can use when creating a Maven site.

Inject XHTML into HEAD

To inject XHTML into the HEAD element, add a head element to the body element in your project’s Site descriptor. Example 15-13 adds a feed link to every page in the sample-project web site.

Example 15-13. Injecting HTML into the HEAD element

<project name="Hello World">
  ...
  <body>
    <head>
      <link href="http://sample.com/sites/sample-project/feeds/blog"
            type="application/atom+xml" 
            id="auto-discovery" 
            rel="alternate" 
            title="Sample Project Blog" />
    </head>
    ...
  </body>
</project>

Add Links Under Your Site Logo

If you are working on a project that is being developed by an organization, you may want to add links under your project’s logo. Assuming that your project is a part of the Apache Software Foundation, you might want to add a link to the Apache Software Foundation web site right below your logo, and you might want to add a link to a parent project as well. To add links below your site logo, just add a links element to the body element in the Site descriptor. Each item element in the links element will be rendered as a link in a bar directly below your project’s logo. Example 15-14 will add a link to the Apache Software Foundation followed by a link to the Apache Maven project.

Example 15-14. Adding links under your site logo

<project name="Hello World"> ... <body> ... <links> <item name="Apache" href="http://www.apache.org"/> <item name="Maven" href="http://maven.apache.org"/> ...

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