SiteMesh 3 Grails Plugin demonstrating how to use SiteMesh 3 instead of SiteMesh 2
Check out using SiteMesh 3 layouts on GSP and JSP pages, error pages, specifying layouts in controllers, and even applying multiple layouts to the same view!
You can see a working example by running this plugin:
./gradlew bootRun
Modify build.gradle
to use the plugin
repositories {
// ...
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
implementation("org.sitemesh:grails-plugin-sitemesh3:7.0.0-SNAPSHOT")
// ... existing dependencies
}
oss snapshots
is needed until the plugin are officially released.
Your app is now using SiteMesh 3 and is no longer using SiteMesh 2. NO FURTHER CHANGES NEEDED.
Bonus: You can now enjoy multiple layouts on each page!
For instance, let's use /grails-app/views/layouts/googleAnalyticsLayout.gsp
and /grails-app/views/layouts/main.gsp
:
<html lang="en">
<head>
<meta name="layout" content="googleAnalyticsLayout, main"/>
<title>Home</title>
</head>