PanzerkampfPL Posted March 4, 2023 Share Posted March 4, 2023 (edited) Hi there! At GSC, I see as if products don't have a meta description. In /themes/classic-rocket/templates/_partials/microdata-jsonld.tpl is: {/if} {if isset($product) && $page.page_name == 'product'} <script type="application/ld+json"> { "@context": "http://schema.org/", "@type": "Product", "name": "{$product.name}", "description": "{$page.meta.description}", "category": "{$product.category_name}", "sku": "{$product.reference}", But unfortunately when I display the source of the product page this variable is empty: I noticed that if I create a "short description" in BO or write it in the "SEO" tab it inserts correctly. Is there any way to modify the code so that the "short description" is automatically substituted from the "long" description field? Taj how it is in the visual preview in BO? Forgive such a simple question but I'm a noobie at modifying code. Edited March 4, 2023 by Panzerkampf cant paste rawe code? (see edit history) Link to comment Share on other sites More sharing options...
Prestachamps Posted March 16, 2023 Share Posted March 16, 2023 Hello @Panzerkampf You can replace the "description": "{$page.meta.description}", with the following code which will use the product description truncated to a 150 character max length text in case of the meta description is empty: "description": "{if !empty($page.meta.description|strip:"")}{$page.meta.description|regex_replace:"/[\r\n]/" : " "}{elseif !empty($product.description|strip:"")}{$product.description|strip_tags:false|regex_replace:"/[\r\n]/" : ""|truncate:150 nofilter}{/if}", I hope that I could help. Have a nice day, Leo. Link to comment Share on other sites More sharing options...
PanzerkampfPL Posted March 18, 2023 Author Share Posted March 18, 2023 @Prestachamps Thank you very much. I have replaced this piece of code and it looks like the problem is solved thanks to you! I'm waiting for GSC to process the amendment. Thank you again! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now