Delivery API SPA references question

50 views
Skip to first unread message

Christoph Damm

unread,
Sep 27, 2023, 9:23:45 AM9/27/23
to Magnolia User Mailing List
Hello,

i was wondering if someone has an idea for the following.
First of all: We have a next application that uses magnolia headless.
In general the page root node e.g. is called 'Home', we have a uri2repository mapping for that.
The delivery endpoint for the pages itself is configured with a jcrReferenceResolver to map page links stored via UUID to paths, those paths resulting are fine (not including the "Home") in the path.
So far so good.

However, we want to build the top level navigation dynamically, hence having a pagenav delivery endpoint that fetches the pages, e.g.:

class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
workspace: website
depth: 0
includeSystemProperties: false
systemProperties:
- mgnl:template
limit: 50
nodeTypes:
- mgnl:page Now: the returned @path property is obviously the path to the node, hence "Home/pagea" Is there a "built-in" way to get a path of the page that is also "resolved" in regards to uri2repository mapping?
Defining a resolver on the @id property does not work.

Any other ideas?
We thought about either defining an extra resolver or a custom rest endpoint for the navigation.
Thanks Chris

Mikaël Geljić

unread,
Oct 3, 2023, 5:04:05 AM10/3/23
to Magnolia User-List
Hi Chris,

The custom rest endpoint is probably the easiest here. That can be pretty light-weight, but then make sure to return a dedicated type for your navigation (returning javax.jcr.Node would result in the same serialization as delivery).
  
Resolving or relativizing @path would need a suggestion / feature request, as it's done directly in the serialization process (NodeWriter), so it's hard to extend/replace.

Hope this helps,
Mika

--
You received this message because you are subscribed to the Google Groups "Magnolia User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to user-list+...@magnolia-cms.com.
To view this discussion on the web, visit https://groups.google.com/a/magnolia-cms.com/d/msgid/user-list/CAGgPrdg12nDL4fMYSZMn_Q-49o6ep0WnPx8YbrBv7A9RmZH0-Q%40mail.gmail.com.

Christoph Damm

unread,
Oct 17, 2023, 6:30:16 AM10/17/23
to Magnolia User Mailing List, Mikaël Geljić
Hi Mika,
thanks, in the end i ended up with a small custom endpoint.

Thanks and reagards

Chris

Reply all
Reply to author
Forward
0 new messages