1

I'm using Craft in headless mode. It's a multisite setup different languages. I know that's it's possible to query an element by it's uri. Is there a way to check if a full path or an absolute url matches an craft element inside an module or plugin controller action?

For example i would like to check i a path like this examples matches an element on any site and return the entry and site:

/my-example-element
/de/my-example-element

Is there any helper or built in method where i can pass the path and retrieve the matching element?

1 Answer 1

1

You can always use the search function -> https://craftcms.com/docs/4.x/searching.html which works excellent, especially via GraphQl. If you need to query for full Urls I would probably strip it to the pathname using URL in your application before sending it to Craft for searching.
I hope I understood your question correctly ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.