Replies: 8 comments
-
You have to pass the context to the tag to make it work: {{ Statamic::tag('seo:title')->context($__data) }} If you encounter other issues, please post the actual error you are running into. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot @aerni for your reply but how do I access properties from context? Sorry but I am new to Statamic. My data is inside pageData:
I get nothing inside <title></title> tags.
|
Beta Was this translation helpful? Give feedback.
-
I don't understand what you're trying to do. Do you want to get data from an entry or use the Advanced SEO tags? That's a difference. If you want to output the head tag with all the data like title, meta description, social images, etc. You should use this in your layout view:
If you simply want to get data from the entry, you do it like this:
|
Beta Was this translation helpful? Give feedback.
-
This is a little complicated if you are using Layout Components. The SEO Pro addon solved this by automatically pulling the context when it is missing, see here. It would be nice if this addon did the same. |
Beta Was this translation helpful? Give feedback.
-
I don't use Blade myself. Feel free to create a sample repo that recreates how you'd like to use the addon. I'll gladly take a look to implementing this. |
Beta Was this translation helpful? Give feedback.
-
@aerni I use blade exclusively, and using this addon. Very happy with how it all works so far, just would be great to not have to pass context (or at minimum, please add to your docs as Blade is more used in Statamic 4) |
Beta Was this translation helpful? Give feedback.
-
Noted. I'll look into this when I get to it. |
Beta Was this translation helpful? Give feedback.
-
Better Blade support is coming. See #152. |
Beta Was this translation helpful? Give feedback.
-
Nice addon. It seems the most complete solution so far but my problem is that we are using blade and I don't know how to fetch the data.
I've tried
Statamic::tag('seo:title')->fetch()
to get the site title.Also, in a template used by a blueprint I would need to have Entry meta_title | Site title
Beta Was this translation helpful? Give feedback.
All reactions