Replies: 10 comments
-
Maybe we'll add support for CKEditor entries, have to give it some thought. In the meantime, you should be able to pull it off using either object templates or closures; support for both of which was added to SEOmate 3 for Craft 5. Check out the docs for |
Beta Was this translation helpful? Give feedback.
-
@mmikkel Sweet! This will certainly do for now. I completely missed these new features and didn’t realise the Craft 5 docs/release were on a different branch. 🙈 |
Beta Was this translation helpful? Give feedback.
-
…yeah, we should probably move SEOmate 3.0 out of beta at this point 🙃 |
Beta Was this translation helpful? Give feedback.
-
@mmikkel So what is the expected value that the object template / closure should return for the |
Beta Was this translation helpful? Give feedback.
-
For Perhaps it’d be useful if we made it possible to output an asset ID from an object template, for the |
Beta Was this translation helpful? Give feedback.
-
I just tagged SEOMate v. 3.0.0-beta.7 with that change – for image meta tags, object templates can now be used to render an asset ID that SEOMate will use to query for the actual image. Here's how that could look: 'fieldProfiles' => [
'default' => [
'image' => ['{seoImage.one().id}'],
],
], ...the above isn't necessarily something I'd recommend doing (for images, field handle references or closures will a better approach in almost all cases) – but at least this makes object templates not completely unusable for image tags, which admittedly felt a bit awkward. Also took the time to update the docs with a few more examples re: object templates and closures, for the |
Beta Was this translation helpful? Give feedback.
-
Looks good @mmikkel, thanks! I ended up going with a closure and figured that it would expect an asset object. Perhaps you could make the object template return either an asset ID or an image URL? (I feel like the image URL return also worked out-of-the-box in beta.6, probably due to Imager accepting both assets and URLs as inputs.) |
Beta Was this translation helpful? Give feedback.
-
Imager would treat that URL as an external image, which could open a new can of worms. More importantly, Craft core isn't able to transform images by URL, so having that as an option at all, would feel kinda squishy to me. |
Beta Was this translation helpful? Give feedback.
-
Makes sense! |
Beta Was this translation helpful? Give feedback.
-
Also, you're right that using a URL + Imager probably worked in beta.6 – that was not intended, but was due to value sanitation missing for object template and closure generated values; I fixed that as part of beta.7 :) |
Beta Was this translation helpful? Give feedback.
-
Now that CKEditor has baked in support for nested entries which are full-blown elements, similar to the erstwhile Matrix blocks, it'll be useful to specify using field values from nested entries for the SEO values.
Eg: We have a CKEditor field
body
which supports a few nested entry types (image
,video
, etc) and we’d like to pull in the first image from thebody
field to be used as the SEO image. Sticking with the existing matrix field syntax, this could perhaps be expressed as:What do you think?
Beta Was this translation helpful? Give feedback.
All reactions