Skip to content
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

Breadcrumbs List does not render in multi site setup #1207

Closed
ing-ivan-31 opened this issue Sep 6, 2022 · 10 comments
Closed

Breadcrumbs List does not render in multi site setup #1207

ing-ivan-31 opened this issue Sep 6, 2022 · 10 comments
Labels

Comments

@ing-ivan-31
Copy link

Question

Hello,

I have a Craftcms3 project with a multiple sites setup like this (they are all in the same single group):

Screen Shot 2022-09-06 at 12 37 07

My problem when i am trying to get the breadcrumbs only i am getting the homepage on the items, this is happening for all the pages

"breadcrumbList": {
   "@context": "http://schema.org/",
   "@type": "BreadcrumbList",
   "description": "Breadcrumbs list",
  "itemListElement": [
   {
    "@type": "ListItem",
    "item": "https://craft.local/",
    "name": "Homepage",
    "position": 1
    }
],
"name": "Breadcrumbs"
}

I don't know if I am missing something on the configuration of seomatic, the seomatic version used is 3.4.22

Additional context

Screen Shot 2022-09-06 at 12 58 36
Screen Shot 2022-09-06 at 13 00 56

Screen Shot 2022-09-06 at 13 01 58
Screen Shot 2022-09-06 at 13 04 01

@khalwat
Copy link
Collaborator

khalwat commented Sep 6, 2022

The first thing I would suggest it to update to the latest version, which is Version 3.4.37 as of this writing.

@khalwat
Copy link
Collaborator

khalwat commented Sep 6, 2022

Also, I notice that you're using the JSON-LD endpoint, but you're not passing in a siteId parameter? Doing so will cause it to just return the default site's metadata.

https://nystudio107.com/docs/seomatic/advanced.html#meta-container-api-endpoints

@khalwat khalwat closed this as completed Sep 6, 2022
@ing-ivan-31
Copy link
Author

@khalwat, the issue persists on my environment with the version 3.4.37 and also adding the siteId parameter,

Screen Shot 2022-09-06 at 16 10 56
Screen Shot 2022-09-06 at 17 33 45
Screen Shot 2022-09-06 at 17 34 36

@khalwat
Copy link
Collaborator

khalwat commented Sep 7, 2022

Did you fill in different information for each site in SEOmatic -> Site Settings?

Screen Shot 2022-09-06 at 8 18 15 PM

@ing-ivan-31
Copy link
Author

Hi again @khalwat, thanks for the help and answers, related to your last question, I fill in all the different information for each site but I continue with the same problem, below some evidence:

Screen Shot 2022-09-07 at 9 28 27
Screen Shot 2022-09-07 at 9 28 36
Screen Shot 2022-09-07 at 9 28 45

@khalwat
Copy link
Collaborator

khalwat commented Sep 7, 2022

So I just did a test, and it seems to be working as expected.

I tried two simple tests:

URL #1: http://localhost:8003/actions/seomatic/meta-container/meta-json-ld-container/?uri=/&siteId=1

Output #1:

{
    "MetaJsonLdContainer": "<script type=\"application/ld+json\">{\"@context\":\"http://schema.org\",\"@type\":\"WebPage\",\"author\":{\"@id\":\"#identity\"},\"copyrightHolder\":{\"@id\":\"#identity\"},\"copyrightYear\":\"2020\",\"creator\":{\"@id\":\"#creator\"},\"dateModified\":\"2021-03-15T11:40:42-04:00\",\"datePublished\":\"2020-03-27T09:38:00-04:00\",\"headline\":\"Homepage\",\"image\":{\"@type\":\"ImageObject\",\"url\":\"http://localhost:8003/assets/site/_1200x630_crop_center-center_82_none/Screen-Shot-2022-03-22-at-12.56.42-PM.png?mtime=1650309044\"},\"inLanguage\":\"en-us\",\"mainEntityOfPage\":\"http://localhost:8003/\",\"name\":\"Homepage\",\"publisher\":{\"@id\":\"#creator\"},\"url\":\"http://localhost:8003\"}</script><script type=\"application/ld+json\">{\"@context\":\"http://schema.org\",\"@id\":\"#identity\",\"@type\":\"LocalBusiness\",\"priceRange\":\"$\"}</script><script type=\"application/ld+json\">{\"@context\":\"http://schema.org\",\"@id\":\"https://nystudio107.com/#creator\",\"@type\":\"Organization\",\"address\":{\"@type\":\"PostalAddress\",\"addressCountry\":\"US\",\"addressLocality\":\"Webster\",\"addressRegion\":\"NY\",\"postalCode\":\"14580\"},\"alternateName\":\"nys\",\"description\":\"We do technology-based consulting, branding, design, and development. Making the web better one site at a time, with a focus on performance, usability & SEO\",\"email\":\"info@nystudio107.com\",\"founder\":\"Andrew Welch, Polly Welch\",\"foundingDate\":\"2013-05-02\",\"foundingLocation\":\"Webster, NY\",\"image\":{\"@type\":\"ImageObject\",\"height\":\"1042\",\"url\":\"https://nystudio107-ems2qegf7x6qiqq.netdna-ssl.com/img/site/nys_logo_seo.png\",\"width\":\"1042\"},\"name\":\"nystudio107\",\"url\":\"https://nystudio107.com\"}</script><script type=\"application/ld+json\">{\"@context\":\"http://schema.org\",\"@type\":\"BreadcrumbList\",\"description\":\"Breadcrumbs list\",\"itemListElement\":[{\"@type\":\"ListItem\",\"item\":\"http://localhost:8003\",\"name\":\"Homepage\",\"position\":1}],\"name\":\"Breadcrumbs\"}</script>"
}

URL #2: http://localhost:8003/actions/seomatic/meta-container/meta-json-ld-container/?uri=/&siteId=2

Outpu #2t:

{
    "MetaJsonLdContainer": "<script type=\"application/ld+json\">{\"@context\":\"http://schema.org\",\"@type\":\"WebPage\",\"author\":{\"@id\":\"#identity\"},\"copyrightHolder\":{\"@id\":\"#identity\"},\"copyrightYear\":\"2020\",\"creator\":{\"@id\":\"#creator\"},\"dateModified\":\"2021-03-15T11:40:42-04:00\",\"datePublished\":\"2020-03-27T09:38:00-04:00\",\"headline\":\"Homepage\",\"inLanguage\":\"es\",\"mainEntityOfPage\":\"http://localhost:8003/es/\",\"name\":\"Homepage\",\"publisher\":{\"@id\":\"#creator\"},\"url\":\"http://localhost:8003/es\"}</script><script type=\"application/ld+json\">{\"@context\":\"http://schema.org\",\"@id\":\"#identity\",\"@type\":\"LocalBusiness\",\"priceRange\":\"$\"}</script><script type=\"application/ld+json\">{\"@context\":\"http://schema.org\",\"@id\":\"https://nystudio107.com/#creator\",\"@type\":\"Organization\",\"address\":{\"@type\":\"PostalAddress\",\"addressCountry\":\"US\",\"addressLocality\":\"Webster\",\"addressRegion\":\"NY\",\"postalCode\":\"14580\"},\"alternateName\":\"nys\",\"description\":\"We do technology-based consulting, branding, design, and development. Making the web better one site at a time, with a focus on performance, usability & SEO\",\"email\":\"info@nystudio107.com\",\"founder\":\"Andrew Welch, Polly Welch\",\"foundingDate\":\"2013-05-02\",\"foundingLocation\":\"Webster, NY\",\"image\":{\"@type\":\"ImageObject\",\"height\":\"1042\",\"url\":\"https://nystudio107-ems2qegf7x6qiqq.netdna-ssl.com/img/site/nys_logo_seo.png\",\"width\":\"1042\"},\"name\":\"nystudio107\",\"url\":\"https://nystudio107.com\"}</script><script type=\"application/ld+json\">{\"@context\":\"http://schema.org\",\"@type\":\"BreadcrumbList\",\"description\":\"Breadcrumbs list\",\"itemListElement\":[{\"@type\":\"ListItem\",\"item\":\"http://localhost:8003/es\",\"name\":\"Homepage\",\"position\":1}],\"name\":\"Breadcrumbs\"}</script>"
}

I know it's a little hard to read, but you'll see the different URLs, and two different titles: Project ENGLISH and Project SPANISH

Have you tried clearing SEOmatic's caches, or hitting the endpoints directly to see what you see there?

@QUACK07
Copy link

QUACK07 commented Sep 7, 2022

Hi ing-ivan-31, I think you need to update the DynamicMeta.php file following this lines because right now getElementByUri function is hardcoded with __home__ and that uri doesn't exist

Line 282
self::addMetaJsonLdBreadCrumbs($siteId, $uri);
line 314
public static function addMetaJsonLdBreadCrumbs(int $siteId = null, string $uri = '')
line 348
$element = Craft::$app->getElements()->getElementByUri($uri, $siteId, true);

@ing-ivan-31
Copy link
Author

Hi ing-ivan-31, I think you need to update the DynamicMeta.php file following this lines because right now getElementByUri function is hardcoded with __home__ and that uri doesn't exist

Line 282 self::addMetaJsonLdBreadCrumbs($siteId, $uri); line 314 public static function addMetaJsonLdBreadCrumbs(int $siteId = null, string $uri = '') line 348 $element = Craft::$app->getElements()->getElementByUri($uri, $siteId, true);

@khalwat what do you think about this? , i made the test for only homepage in each site id and effectively the url change but when i enter other URI only i am getting the homepage check the screenshots

Screen Shot 2022-09-08 at 8 38 22
Screen Shot 2022-09-08 at 8 38 39
Screen Shot 2022-09-08 at 8 39 00
Screen Shot 2022-09-08 at 8 39 17

@khalwat
Copy link
Collaborator

khalwat commented Sep 9, 2022

So you have no element that is designated as being the homepage of the site (it would have the special URI of __home__), whether that be a single or an entry in a structure or the like?

If not, then SEOmatic can't automatically determine the home page properly for you.

@khalwat khalwat reopened this Sep 9, 2022
@ing-ivan-31
Copy link
Author

So you have no element that is designated as being the homepage of the site (it would have the special URI of __home__), whether that be a single or an entry in a structure or the like?

If not, then SEOmatic can't automatically determine the home page properly for you.

You have right @khalwat, the homepage is missing on our craft configuration when i set the homepage all the breadcrumb lists started to work on our pages.

thank so much, for your help and support.

Screen Shot 2022-09-09 at 12 58 08
Screen Shot 2022-09-09 at 13 22 12
Screen Shot 2022-09-09 at 13 27 30

@khalwat khalwat closed this as completed Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants