Adding structured data to product page

  • fe_rojas-1359235165104377986

    FeRojas

    20 days ago

    Hi! Im having trouble adding a structured data in the body of a product page. Tried different configurations, but still https://search.google.com/test/rich-results?hl=es-419 dont recognize it. Only way that it worked for me, is by adding the script to the head of the page, the problem with that is that affects loading performance. The problem seems to be that it wraps the script content in <span data-node-type="text" ...>

    Any help with this would be really appreciated πŸ™Œ .
    1359235165406363688-image.png
    1359235165993439534-image.png
  • erikbeus-1359237659288928286

    Erik Beuschau

    20 days ago

    You can add a script to head on the page’s configuration. Similar to when you add other head elements (meta tags for instance)
  • fe_rojas-1359240280263491714

    FeRojas

    20 days ago

    Yes, it worked when I added the script to the <head>. I was trying to put it in the <body> to avoid impacting loading performance.
  • lucasg-1359245685647736932

    Lucas G

    20 days ago

    This type of script shouldn’t really impact performance unless your backend is just really slow
  • lucasg-1359246038325661917

    Lucas G

    20 days ago

    It’s when you’re loading external things that you should be careful
  • fe_rojas-1359251672173514762

    FeRojas

    19 days ago

    I'm using Supabase. Yes, after doing some performance tests, I found that it didn't affect performance too much (it's not noticeable). Thanks again @Lucas G πŸ‘!
  • lucasg-1359252279819112609

    Lucas G

    19 days ago

    You’re likely already using that data anyways in the body no?
  • fe_rojas-1359252369476554923

    FeRojas

    19 days ago

    Yes, is almost all but not all.
  • lucasg-1359252396043145276

    Lucas G

    19 days ago

    Gotcha
  • lucasg-1359253043371315461

    Lucas G

    19 days ago

    Se ve bien en mΓ³vil πŸ‘
  • fe_rojas-1359253061515743242

    FeRojas

    19 days ago

    Yep, performance still good πŸ™Œ
    1359253061259760060-image.png
  • Toddle so amazing
  • fe_rojas-1359253228683923656

    FeRojas

    19 days ago

    Jajaja gracias!
  • paspom-1359881729598423050

    Pascal

    18 days ago

    Hey, this sounds very interesting, why are you doing this, why should I do this – is this relevant for SEO?
  • whitep4nth3r-1359890099302567937

    salma

    18 days ago

    Yes primarily for SEO. It enables e.g. rich results in search engines (think reviews for products, ingredients for recipes etc showing directly on the search result page)

    You can do similar things using schema.org markup in HTML, the way discussed in this thread is using JavaScript/JSON.

    https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data
    ❀️1
  • paspom-1359924578238988368

    Pascal

    18 days ago

    Oh nice!
    Thanks salma!
    By the way, is there a way I can expose data in the page head from a component and not the page root level?
  • whitep4nth3r-1359924834540327055

    salma

    18 days ago

    You don’t need to do it in the head. All of this stuff can go in line wherever the component lives in the page. I would recommend that approach for maintainability actually as well.
  • paspom-1359925592476090459

    Pascal

    18 days ago

    Oh really? I should look into this topic, shouldn't I?
    Just in case you have it, but do you have an example project at hand?
  • whitep4nth3r-1359930012702212147

    salma

    18 days ago

    I have an example on my website but it’s not built with toddle (yet!)
  • But even on my current website the structured data is near the relevant HTML
  • paspom-1359935639235068004

    Pascal

    18 days ago

    Ha, you page is pretty easy to find, good job
    Ok anyway, I'll find a way (building something for the community btw, gathering as much high end ready for production stuff as I can find)
    πŸ™Œ1
  • kamilnader-1360286138967003386

    Kamil

    17 days ago

    For now, the schema needs to be in the head because script tags in the body are not server rendered (for now). It's best to place the schema markup in your CMS and then dynamically load the right one based on the current page.
  • kamilnader-1360286789239312425

    Kamil

    17 days ago

    I did this for a SPA/website with nearly 9,000 pages, where almost every other page has different schema markup.
  • whitep4nth3r-1360286944780750868

    salma

    17 days ago

    Ah that makes sense with regards to how toddle currently works. Still adjusting my mental model from years of other frameworks ☺️
    πŸ‘1
  • Schema tags, however, are placed on the html, which would be server rendered
    πŸ‘1
  • fe_rojas-1360289079933141083

    FeRojas

    17 days ago

    I doing it for SEO, for rich results in search engines. Google adds them automatically to Google merchants that is a very good source for traffic for products. Toddle allows to build this dinamically for each page, is great.
    πŸ‘1
  • fe_rojas-1360292652536561875

    FeRojas

    17 days ago

    The way I added is that I first added an external resource
    1360292652293030019-image.png
  • And then a formula for the content
    1360292823433478175-image.png
  • fe_rojas-1360293359385706507

    FeRojas

    17 days ago

    For that create a Json-ld with an external tool (or Claude) and then paste it in a Json node, so you dont have to create the json object from scratch. Then is possible to create dinamically the entire object from data from the database.
    1360293359196831986-image.png
  • paspom-1360300989910876180

    Pascal

    17 days ago

    whoa! πŸ‘Œ