Closed JustJarethB closed 5 years ago
Hi,
SEOMate works out of the box with commerce. I'm not able to reproduce the error you're describing. But the line referenced is in prepAlternateUrlForSite
which is used to get the alternate urls for the different site. There should probably be a check for it there, but it would be interesting to know why url is null. You have public url's for your products set up on the product types? Do all of your sites have url's?
Hi! We have a multisite setup but one of the sites isn't being worked on yet, it's more of an empty shell. The store on the main site (which had the hook in the templates) has a URL for each product type set up, but the other site does not have URLs set up. I would expect them to be completely separate though, I don't know why the seomate plugin would need a url for a product on a different site?
I've added a fix for the error you're seeing, turns out it would occur for any element that had url's in some sites, but not in others. It'll be in the next tagged release.
I would expect them to be completely separate though, I don't know why the seomate plugin would need a url for a product on a different site?
By default, seomate outputs alternate urls for elements that exists in several sites. You can turn this off using the outputAlternate
config setting, see the documentation for a description on when to disable it.
We're looking into adding preview to commerce products..
This issue should be resolved in SEOMate v1.0.5 – which also adds the SEO Preview feature for Products.
Does anyone have an example of the sitemapConfig details for showing products in the sitemap?
@kevadamson To generate sitemaps for other Element types than Entries – such as Commerce Products – you'll need to declare the classname for that Element type using the elementType
attribute:
'sitemapConfig' => [
'elements' => [
'products' => [
'elementType' => \craft\commerce\elements\Product::class,
'params' => ['changefreq' => 'daily', 'priority' => 0.5],
],
]
],
Note that in addition to elementType
and params
you can also add a criteria
array containing any Element Query parameters you might want SEOMate to use when generating the sitemap (for products, could be something like 'criteria' => ['type' => 'shirts']
or whatever).
I tried to use the
seomateMeta
hook for product pages but it throws an error.On further inspection I also notice the lack of SEO Preview mode on products. Could you advise?