Developing a custom pages app
This page describes how to develop a custom pages app whose features are similar to the Magnolia Pages app but is tailored to the needs of your project, for example to:
-
Provide a custom action to create a page that is linked to some external content.
-
Store the content in a custom workspace and with a custom node type.
Currently, it is not possible to create a custom pages app with Magnolia Light Development alone. A custom Java module is required. |
Introduction
You can provision the Page Editor UI in any app, creating a more powerful and intuitive Magnolia for you Authoring team(s).
Authors may want to use the Page Editor UI in other apps besides the Pages app. For example, to create:
-
a Mobile or Kiosk apps, to allow editing of multiple channels.
-
a Reusables app, to allow creation of parts of pages which could be reused in many pages.
This is supported in both the FreeMarker and the headless modes.
Example
Follow these steps to try the demonstration which will create a custom pages app which utilizes a custom workspace
and nodeType
.
-
Clone the custom-pages-app-barebones repository.
-
Execute the
mgnl jumpstart
command and in the two templates lists displayed consecutively, select thedemo-webapp
andmagnolia-community-demo-webapp
templates. -
Build the module (a) and copy the jar file into the webapp (b):
-
cd custom-pages-support && mvn clean install && cd ..
-
cp custom-pages-support/target/custom-pages-support-1.0.0-SNAPSHOT.jar apache-tomcat/webapps/magnoliaAuthor/WEB-INF/lib/
-
-
Run
mgnl start
. -
Run the React application:
-
cd spa/spa-react-app
-
npm install && npm run start
-
-
In the Security app, assign permissions to the
rest-anonymous
user role.-
On the Access control lists tab, set
CustomWebsite
toRead Only
for the/
path. -
On the Web access tab, assign the
Get
method to the/.rest/annotations/*
path.
-
Implementation tips
-
The
workspace
andnodeType
are registered through thecontentType
. See/light-modules/custom-pages-app-lm/contentTypes/customPages.yaml
in the cloned repository. -
The new template annotation (
/light-modules/custom-pages-app-lm/restEndpoints/annotations/
) and delivery (/light-modules/custom-pages-app-lm/restEndpoints/delivery/
) endpoints now target the custom workspace.The SPA is updated to use this custom annotations endpoint. See
spa/spa-react-app/src/environment.js
.
|