-
Notifications
You must be signed in to change notification settings - Fork 36
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
How can we get the generated meta for a entry once we have the entry instance? #248
Comments
Came here looking for the same. This used to work: $tags = new SeoProTags();
$tags->setContext($this->page);
return $tags->metaData(); But yesterday updated to the latest version and it doesn't seem to work anymore, just returns the entry provided as Haven't had the time to look much into it, and probably will not during the week, but if I do I'll let you know. |
Turns out I needed to fix this sooner than expected. 😅 So, in my case the fix was just to wrap the entry like so: $tags = new SeoProTags();
$tags->setContext($this->page->toAugmentedCollection());
return $tags->metaData(); On a quick inspection it doesn't seem to differ much from the previous function, but you could also do something like: use Statamic\SeoPro\Cascade;
use Statamic\SeoPro\GetsSectionDefaults;
use Statamic\SeoPro\SiteDefaults;
class SEO {
use GetsSectionDefaults;
public funtion get($page) {
return (new Cascade())
->with(SiteDefaults::load()->augmented())
->with($this->getAugmentedSectionDefaults($page))
->with($page->augmentedValue('seo')->value() ?? [])
->withCurrent($page)
->get();
}
} |
What would be |
In the first code block In the second code block, I suppose you are referencing to the method |
A 'page' in SEO Pro, is a collection entry or a taxonomy term, both of which can store |
This is a good feature request. I created a more concise FR issue here, but feel free to use the above-mentioned workarounds until we have time to properly implement this 👍 |
Whoa I'm super surprised this isn't supported (or in the REST API), very bummer. |
It appears the only way to fetch the generated meta fields for an entry is by utilizing the tag in a view, but we wish to programatically fetch the generated meta fields.
Is there a way to do this? Once we have the Entry variable, is there a proper way to generate. All we can see is by using the tag, but it requires a context and when we're programatically working, we don't have a view context.
The text was updated successfully, but these errors were encountered: