Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2 final
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Testcase included:yes
Description
Today I tried to write a tag that would write out a dynamic meta tag so that the layout of a page can be determined at runtime, eg:
def useAdminLayout = { attrs ->
def layoutSetting = ConfigurationHolder.config.weceem.admin.layout
def layoutName = layoutSetting instanceof String ? layoutSetting : 'weceemadmin'
out << "<meta name=\"layout\" content=\"$layoutName\"/>"
}
Using this in a GSP page in <head> instead of inlining a <meta> tag, results in the layout not being picked up.
On further investigation it seems that any tag that renders <meta> tags is ignored by sitemesh.
Attached is a sample app that uses g:render to try to render the meta tag. It does not pick up any layout for the page (index.gsp_
Attachments
Issue Links
| This issue is related to: | ||||
| GRAILS-5662 | layout in error.gsp doesn't work any more |
|
|
|
This may be a workaround...
def page = request[com.opensymphony.module.sitemesh.RequestConstants.PAGE] page.addProperty('meta.layout', 'whatever')I don't know if this is set too late for SiteMesh to pick it up though.
def page = request[com.opensymphony.module.sitemesh.RequestConstants.PAGE] page.addProperty('meta.layout', 'whatever')