nystudio107 / craft-seomatic

SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
https://nystudio107.com/plugins/seomatic
Other
163 stars 69 forks source link

[FR] Ability to define 'SEO Image from field' for entryTypes. #239

Closed oadslug closed 5 years ago

oadslug commented 5 years ago

Forgive me if I'm just missing functionality here, I've only had a chance to poke around a little bit with the new craft 3 version.

In Craft2 SEOmatic, it was possible to define an SEO field that allowed you to define the 'SEO Image Source from field', 'SEO Description from field', etc at the field level, and then attach that field to the requisite section/channel/entryType as needed.

In Craft3 SEOmatic, I'm not seeing this functionality. As far as I can tell you can only define a 'SEO Image Source from field' at the global level? The 'SEO Settings' field meanwhile, has no defaults that can be set. The problem is that each section/channel (and sometimes even different entryTypes within a section/channel) use a different image or description field as the basis for default SEO data (i.e. 'pages' use 'pageImage', posts use 'postImage', 'products' use 'productHero', etc.).

Obviously I can create/assign a separate 'seoImage' and 'seoDescription' field to every field layout, but this seems opposite of what the plugin is attempting to do, which is use content already defined in the page, and ease the need for additional data entry. Furthermore, even if there is a separate 'seoImage' field (or they used an 'SEO Settings' field) the image would necessarily be from a different asset source, and the user would have to either upload a duplicate image, or hunt down the correct source/subfolder/image to use — which is a bit daunting. I would prefer the client not have to navigate the entire image source tree (and potentially upload images in random places).

The Craft2 SEOmatic approach seemed much more intuitive/user friendly, in that, for the most part, everything is defined by the developer and is automatic, and the client doesn't really need to think about SEO.

Is there perhaps something I am overlooking in my approach? Thanks.

khalwat commented 5 years ago

So there are a few separate things going on here.

SEOmatic for Craft 3.x should make things much simpler for setting up most sites, you just define the mappings you speak of in the Content SEO settings on a per Section basis.

What you're talking about is having a separate Content SEO settings on a per-Entry Type basis. I think there is an open issue concerning this, and I'm still not sure the best way to handle it.

Finally, you're right that it'd be nice to have default settings for the SEO Settings fields. It could get a bit involved given the amount of information that can be in the Field tho, so I'm thinking that a better way to do it is via Content SEO, and then you use the SEO Settings field as intended, which is for just when you need a per-entry override.

oadslug commented 5 years ago

SEOmatic for Craft 3.x should make things much simpler for setting up most sites, you just define the mappings you speak of in the Content SEO settings on a per Section basis.

I think that I missed this fact entirely — you CAN define settings on a per section basis! This should cover 99% of use cases. Awesome!

As per entryTypes, I have run into this issue in the past, but not very often. Being able to define defaults in the SEO Settings field would be one way. Another option to consider is perhaps the ability to define/reassign defaults in the template itself using twig variables.

As per the major point here, however. I was definitely missing a huge part of the functionality. Thank you for pointing this out!

khalwat commented 5 years ago

As per entryTypes, I have run into this issue in the past, but not very often. Being able to define defaults in the SEO Settings field would be one way. Another option to consider is perhaps the ability to define/reassign defaults in the template itself using twig variables.

So this is something I spent quite a bit of time on for SEOmatic for Craft 3; there's actually a pretty robust Twig API for changing anything you want:

https://github.com/nystudio107/craft-seomatic#twig-templating

You can change pretty much anything via Twig.

I'll keep this open because I do think the issue of multiple entry types is something I'd like to address in some fashion.

oadslug commented 5 years ago

Great. Thank you! I'll review template API more carefully.