Skip to content
An activator seed template and demo application to illustrate the Pagelets Module for the Play Framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Build Status

Hello Pagelets!

just a few minutes and you have a complete Play application based on the Play Pagelets Module running.

See the app in action: Pagelets on Heroku *note that it runs on a free dyno which takes a couple of seconds to wake up.


The demo application serves the purpose to

  • showcase the Play Pagelets Module and it's advantages
  • demonstrate how to build a pagelet based application
  • serve as a template for pagelet based projects

What is a Pagelet

A pagelet is a small independent unit which consists of view, controller action and optionally a service which obtains the data to be rendered. Usually a web page is composed of multiple pagelets.

The demo app

This demo application shows how a modular and resilient web application can be built using the Playframework 2 and the Play Pagelets Module.

This example app is a small multi-language website. The page is composed of multiple pagelets. Each pagelet is completely independent and obtains data from a remote service and renders the data by means of a standard twirl template.

Depending on the selected language, the home page is composed from different pagelets. This shows how the page composition can be manipulated at runtime based on the properties of an incoming request.

The demo also invites to to simulate failure by configuring remote services to time-out or serve broken data.

To get a rough idea what the pagelet API looks like:

A page configuration

def tree(r: RequestHeader) = 
  Tree('root, Seq(
    Leaf('header, header _).withJavascript(Javascript("lib/bootstrap/js/dropdown.min.js")),
    Tree('content, Seq(
      Leaf('carousel, carousel _).withFallback(fallback("Carousel") _),
      Leaf('text, text _).withFallback(fallback("Text") _)
    Leaf('footer, footer _).withCss(Css("stylesheets/footer.min.css"))

A main action to render a complete page

def index = PageAction.async(routes.HomeController.errorPage)(_ => "Page Title", tree) { (request, page) =>

A pagelet (just a standard Play action)

def carousel = Action.async { implicit request => { teasers =>

A fallback pagelet (also just a standard Play action)

def fallback(name: String)() = Action {

Getting started

If you have activator installed, just enter:

activator new

Otherwise open a terminal and

  • clone the github repository with
git clone
  • then enter
cd play-pagelets-seed
  • then enter
sbt run

then point your browser to http://localhost:9000

If you are interested in more details, check out the main Play Pagelets repository

You can’t perform that action at this time.