Uploaded image for project: 'Magnolia pages module'
  1. Magnolia pages module
  2. PAGES-560

SPA renderer supports site prototype, including baseUrl and routeTemplate

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Critical
    • 6.2.17
    • None
    • None
    • None
    • Yes
    • DevX 2, DevX 3, DevX 4
    • 5

    Description

      Previously the spa renderer did not support the site template prototype feature, now it does.

      This is a convenient and preferred way to have every template in a site use the same `baseUrl` and `routeTemplate` properties.

      Docs:

      https://docs.magnolia-cms.com/product-docs/6.2/Templating/Site-definition/Template-prototype.html

       

      Problem description

      Currently baseUrl and routeTemplate properties are not supported by the site "template prototype" feature which makes projects cumbersome to work with, and is an obstacle for customers to adopt the "external SPA" feature.

      Implement support for "baseUrl" and "routeTemplate" properties in the out-of-the-box site template prototype feature.

      Tech note

      Docs: https://docs.magnolia-cms.com/product-docs/6.2/Templating/Site-definition/Template-prototype.html

      It appears that the default class does not support the needed properties, info.magnolia.module.site.templates.PrototypeTemplateDefinition

      Docs on "baseUrl" and "routeTemplate:

      https://docs.magnolia-cms.com/product-docs/6.2/Developing/SPA-development-and-Magnolia/SPA-hosting.html#_connecting_an_external_spa

       

      Sample Project

      I've (Topher) prepared a sample of what I would expect to work. In preparing it I first just try to get the site "template prototype" feature to work with SPA rendering at all by using the case of the "area" definition. But I could not get even this to work, so maybe there are some more fundamental issues with the site "template prototype" feature - but its also possible I don't have things configured correctly.

      Please see branch: "site-test" (it just has one commit.)

      https://git.magnolia-cms.com/projects/DEMOS/repos/minimal-headless-spa-demos/browse?at=refs%2Fheads%2Fsite-test

      The sample uses the "react-minimal" project.

      I was running it on DXCore with the travel demo installed.

      The branch is currently setup to just use the "main" area as a test case. It is expected that if I edit the sample "react-minimal" page, that the "main" area is editable, but in my tests it was not editable.

      But you can also see the baseUrl and routeTemplate properties are configured (but commented out..)

       

       

      It probably makes more sense to keep baseUrl and routeTemplate in the site configuration instead of template definition.
      Continue to allow it to be specified in the page template. If specified in site and page - then the value in page is used.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                dai.ha Dai Ha
                rsiska Robert Šiška
                DeveloperX
                Votes:
                3 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD

                    Time Tracking

                      Estimated:
                      Original Estimate - Not Specified
                      Not Specified
                      Remaining:
                      Remaining Estimate - Not Specified
                      Not Specified
                      Logged:
                      Time Spent - 1d
                      1d