Defining the Pages’ Header and Footer

With master pages, you can define common elements for pages’ headers and footers. Clarity has just one page currently, the home page. Since this was created before any master page was available, the blank master page was associated to the page automatically. The header has the Liferay logo and label, a page-based navigation menu, the search bar widget, and the Sign In/personal menu.

The default header and footer are useful, but replaceable.

Because Clarity needs their own header and footer design, you’ll create a master page to define the header and footer and re-use it across the entire site for all pages.

  1. Open the Site Menu (Product Menu), then click DesignPage Templates.

  2. Click Add (Add) and name the page Clarity MP.

    The content page editor appears. By default, the page has only one element: a drop zone. Clarity’s header and footer should appear above and below the drop zone.

  3. In the Fragments and Widgets (Fragments and Widgets) menu on the sidebar, drag J2B6 Header Composition above the drop zone, then drag J2B6 Footer Composition below the drop zone.

    You imported these fragment compositions in the previous step, Importing Fragments and Resources.

  4. Map the image fragment in the header to a logo. Open the browser (Browser), expand the Header Container element, and continue expanding elements until you get to the first grid module’s image fragment.

    Click the image fragment's inner element to set the source of the image.

  5. Click the image fragment to open its settings, then click image-square to set the source of the image.

  6. Choose direct source selection, then choose the image clarity_logo.

    Set the image to use in the header.

  7. Using the same procedure, add the clarity_logo image to the footer’s image fragment.

    Set the image to use in the footer.

  8. Click Publish Master.

    The user menu is a custom fragment: J2B6 User Navigation Dropdown. It uses HTML and CSS to create a menu for logged in users. For logged out users, they see a user icon and the words SIGN IN, which they can click to access the sign in page.

    Logged in users see a menu with links to important pages.

The master page is in place. Right now the header and footer both contain menus that show the page hierarchy of the site. This will be improved in Creating Navigation Menus. Right now it’s time to configure Liferay to use the master page on the existing Home page and in all widget pages (e.g., the existing Search page).

  1. Open the master page’s Actions menu (Actions) and click Mark as Default. Confirm that you want to use this master page as the default for all widget pages.

  2. Go to the Home page and click Edit (Edit) in the administrative header.

  3. In the content page editor, open the Page Design Options sidebar menu (Page Design Options) and select Clarity MP.

  4. Click Publish.

  5. Use a similar procedure to configure the default utility pages (404 and 500 error pages) to use the master page. In the Site Menu (Product Menu), click Site BuilderPagesUtility Pages.

Your master page now defines the header and footer.

The header and footer is in place.

Even with a header and footer, the look and feel is not yet well polished. Links are all currently blue and do not match with Clarity’s brand colors, for example. Instead of spending time manually fixing this, leave it for now. The theme CSS client extension you deploy later will remedy these visual faults.

Next: create the rest of the site’s pages.

Relevant Concepts

Ask

Capabilities

Product

DXP

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy