Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-7210

VirtualUriMappings to Variations with different extentions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • 5.6
    • Virtual URI mappings
    • None

    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

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              frontools Cédric Eberhardt
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD