[MAGNOLIA-7214] Freemarker #compress directive on page template break direct area rendering Created: 05/Dec/17  Updated: 11/Mar/21  Resolved: 11/Mar/21

Status: Closed
Project: Magnolia
Component/s: templating
Affects Version/s: 5.5.7, 5.6
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Viet Nguyen Assignee: Unassigned
Resolution: Workaround exists Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Java Source File AggregatorFilter.java     Java Source File AreaFilteringListener.java     Zip Archive lightmodule1.zip     Zip Archive patch.zip    
Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

As described in linked ticket SUPPORT-8176 (thanks to Federico Navarro for his information):

We've tried recently to add the #compress Freemarker directive to a page template, and as it turns out, this seems to be breaking the rendering of subcomponents when navigating to them via selectors.
Eg (same selector uri in both cases: selector uri: /simple~mgnlArea=content~ )
Without #compress in page template:

For short, using attached lightdev module info, this URL is not gonna be rendered correctly (missing a bit of text at the end):
http://host:port/your_context_webapp/simplecompress.html~mgnlArea=content~
What in the compress file lightmodule1.zip :

  1. An exported XML page - website.simplecompress.xml
  2. A page template folder with its yaml and ftl
  3. A component template folder with its yaml and ftl
  4. Put them to your lightdev module, import the page to page app, access to the URL to reproduce the issue.


 Comments   
Comment by Viet Nguyen [ 05/Dec/17 ]

The issue still happen even though we disabled both server and browser caches, flush all caches and also disabled Gzip filter.

Comment by Viet Nguyen [ 05/Dec/17 ]

A work around is that remove 'compress' directive from page level and move them to each component level. In this case, remove 'compress' from simplepage.ftl and add it again to your component level (area level) file (simplearea.ftl). Checked and the Freemaker 'compress' still working in that level.

Comment by Viet Nguyen [ 21/Dec/17 ]

Added a patch patch.zip and source AggregatorFilter.java & AreaFilteringListener.java .

Comment by Richard Gange [ 04/Sep/20 ]

Another workaround is to not use the compress directive at all. Google provides a library for compressing HTML. Magnolia Forge provides the filter https://wiki.magnolia-cms.com/display/WIKI/HTML+Compressor.

Comment by Viet Nguyen [ 11/Mar/21 ]

Please consider using workaround solutions for this and try not to use "compress" directive of FTL.

Generated at Mon Feb 12 04:21:47 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.