In this tutorial you will see how to add a new page to Alfresco Share. In the following tutorial you will see how to make this new page the default landing page.
Adding a new page into Alfresco Share requires a minimum of three files:
- A Page definition file
- A Template-Instance definition file
- A FreeMarker template file
- In the Eclipse Package Explorer, create a new folder called pages in config/alfresco/site-data/.
In the pages folder create a new file called home-page.xml
with the following contents:
<page> <template-instance>home-page</template-instance> <authentication>user</authentication> </page>
This is the page definition file. This defines the page name (which is the file name) and a mapping to a Template-Instance that contains the content. It also defines the level of authentication required to view the page.
- In the Package Explorer, in config/alfresco/site-data, create another new folder called template-instances.
In the newly created template-instances folder, create a new
file, also called home-page.xml with the following contents:
<template-instance> <template-type>tutorials/home-page</template-type> </template-instance>
This is the Template-Instance definition. This creates a mapping to the actual FreeMarker template that contains the content for the page.
Create a new file in config/alfresco/templates/tutorials
called home-page.ftl with the following contents:
<html> <head> <title>Tutorials Application</title> </head> <body> Welcome To Extreme Share Customization! </body> </html>
This is the FreeMarker template file. This contains the actual page content. The example shown here is trivial but this could also contain regions for binding Alfresco Surf components if required.
- Build your project using the Ant build script as done in previous tutorials.
- Restart the application server.
In your web browser open the following location
You will be prompted with the standard Alfresco Share login screen.
You are asked to log in because in the page definition file you set the authentication level to be user, that is the page is accessible to all logged in users. To create a page that can only be accessed by administrators using an authentication level of admin. To create a page that can be accessed by any user, including those who are not logged in, set the authentication level to none.
Log in using your credentials.
After logging in your new home page will be displayed.