Plugins You can find out about all the publicly available Grails plugins.

DjangoTemplates Plugin

  • Authors: Daiji Takamori
0 vote
compile ":DjangoTemplates Plugin:not provided"



DjangoTemplates Plugin

This is a simple plugin to provide Django-style templates. This was created upon a suggestion by one of the devs that having the functionality of Django's templates would be handy.

Author: Daiji Takamori - Plugin Package:


To install the DjangoTemplates plugin type this command in your project's root folder:

grails install-plugin /path/to/
At the moment you'll then need to compile the Java classes in the plugin by running
grails package
I plan on addressing this issue later.


Create a template as you normally would. If you want to create a layout, remember to prefix the name with an underscore. If you are using a relative path then you will need to prefix the path with an underscore instead. Use <g:declareBlock> to define a section of replaceable GSP.

In your views (or even in another template), use <g:extends> where you'd like to extend a given template. Replace the sections you'd like to replace using <g:block>, even with other GSP, if you'd like.

Taglib API


The following (defined in a template) will define a block named "section" with default content "Some default content".

<g:declareBlock name="section">Some default content</g:declareBlock>

g:extends and g:block

The following will extend a template named "_templatepath.gsp" in the current directory, but replaces the section named "section" with "Replaced default content". The template is prefixed with "Some pretext" and suffixed with "Some posttext".

Some pretext
<g:extends template="templatepath">
	<g:block name="section">Replaced default content</g:block>
Some posttext