New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Element API integration #312
Comments
Probably the reason that isn't working is that there is no I'm guessing you might just want to use the existing controllers that SEOmatic provides for obtaining meta information? https://github.com/nystudio107/craft-seomatic#meta-container-api-endpoints |
Using the existing endpoints works. But it would be nice if I could get this information (entry details and seo details of the entry) just in one call to the element api :). But if that's not possible, we can always use the existing api endpoints. |
So you're already in the Element API, you can make whatever calls to SEOmatic that you like. Check out what the controller does: Ignoring the caching layer for now, you would end up doing something like: Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true); But really it might be easiest to just run the controller action directly from your code to get back the info you want: $result = Craft::$app->runAction('seomatic/meta-container/all-meta-containers', $params); |
Bottom line: should I use seomatic for a headless site with element api, is it a valid use case and robust/versatile enough? or just add some custom fields to each entry type? |
Yes, it is a robust, valid use-case. You can also use it with GraphQL if you prefer. See: https://nystudio107.com/docs/seomatic/Advanced.html#headless-spa-api |
Hi
I'm trying to integrate Seomatic in the Element Api. But it doesn't seem to give the right values.
How can I get the raw content of the seoTitle, seoDescription and the url of the seoImage?
The title of the page I'm testing is 'Case'.
Thanks for the help!
Katia
The text was updated successfully, but these errors were encountered: