[MAGNOLIA-7210] VirtualUriMappings to Variations with different extentions Created: 30/Nov/17  Updated: 30/Nov/17

Status: Open
Project: Magnolia
Component/s: Virtual URI mappings
Affects Version/s: 5.6
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Cédric Eberhardt Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

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

 Description   

Hi.

Let's say our root page is named `home` and I do a `txt` variation which renders `Hello, world!` as text. If I go to `home.html`, it renders the HTML document and if I go to `home.txt` it renders "Hello, world!", as expected.

variations:
  txt:
    templateScript: /main/templates/variations/txt.ftl # => Hello, world!

Now I create a YAML uri mapping:

class: info.magnolia.virtualuri.mapping.DefaultVirtualUriMapping
fromUri: /test.txt
toUri: forward:/home.txt

and I go to test.txt`, it renders "Hello, world!" as expected.

But if I create another mapping

class: info.magnolia.virtualuri.mapping.DefaultVirtualUriMapping
fromUri: /test.md
toUri: forward:/home.txt

then it renders the HTML document like if I was on home.html or any not configured variations extensions.

The goal of that is that I want to be able to generate multiple JSON async helpers from the root, like, for instance

  • `home.search` to do live search thanks to `jsonfn`
  • `home.manifest` to render `manifest.json` for Progressive Web App with the exact same info configured on the HTML `head`
  • `home.renditions` to have all renditions links from an uuid for all lazy loaded images
  • or whatever JS model helper that needs a page to be rendered

I could have create another root page with another page template but I want to keep all this logic hidden, and safe, for the editor.

It looks like the variations takes into consideration the current `fromUri` extension and not the one on which the redirection is done.

You can currently found all of that on Github: https://github.com/frontools/magnolia-megaton/tree/progressive-web-app


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