• hi good day , checking in Structured Data Testing Tool i found the following error:

    
    Uncategorized Errors1 ERRORexpand_less
    cancelJSON-LD
    	
    Missing ',' or '}' in object declaration.
    <script type="application/ld+json">
    {"@context":"http:\/\/schema.org\/",  ---- 
    "@type":"BlogPosting","datePublished":"2014-10-16T10:18:01+00:00",
    "headline":"<a href="https://xxx.com/xxxxx/">Text text text </a>",
    "mainEntityOfPage":{
    "@type":
    "WebPage",
    "@id":"https:\/\/xxxx.com\/xxxx-en-<a href="https://xxx/category/dxxx-2/">xxxx</a>-y-xxx\/"
    },
    "author":
    {"@type":
    "Person",
    "name":"Author Name"
    },
    "publisher":{
    "@type":"Organization",
    "name":"<a href="https://xxxx.com/category/xxxx-2/">xxx</a> MX",
    "logo":{
    "@type":
    "ImageObject",
    "url":"https:\/\/xxxx.com\/wp-content\/uploads\/2x\/x\/xxx<a href="https://xxxx.com/tag/xxx/">xxxx</a>_logo_by_xxx.png",
    "width":512,
    "height":512
    }
    },
    "dateModified":"2014-10-16T13:41:21+00:00",
    "image":{
    "@type":
    "ImageObject",
    "url":"https:\/\/kerneleros.com\/wp-content\/uploads\/2012\/07\/transmission.jpg",
    "width":390,
    "height":308
    },
    "name":"<a href="https://xxxxxcom/xxxxxxxxx/">Textetxt</a>",
    "aggregateRating":{
    "@type":"AggregateRating",
    "ratingValue":"5","ratingCount":"1"
    }
    }
    </script>

    I do not have much sense but reviewing the code a bit , I see the error throws the following variable $review_name

    error in $review_name = get_the_title();
    $rich_snippet["name"]= $review_name;
    $rich_snippet["headline"] = $review_name;

    It shows well
    "name":"<a href="https://xxxxxcom/xxxxxxxxx/">Textetxt</a>",

    $rich_snippet["@context"] = "https://schema.org/";
    
            //if doesn't exists a filter for yasr_filter_schema_jsonld $review_chosen value is assigned to $filtered_schema...
            $filtered_schema = apply_filters( 'yasr_filter_schema_jsonld', $review_choosen );
    
            //So check here if $schema != $review_choosen
            if ($filtered_schema !== $review_choosen) {
    
                return $content . $script_type . $filtered_schema . $end_script_type;
    
            }
    
    		$author = get_the_author();
    
    		$review_name = get_the_title();
    
    		$date = get_the_date('c');
    
    		$date_modified = get_the_modified_date('c');
    
    		$post_image_url = ''; //avoid undefined
    		$logo_image_url = ''; //avoid undefined
    
    		if (defined('YASR_BLOGPOSTING_ORGANIZATION_LOGO')) {
    
    			$logo_image_url = YASR_BLOGPOSTING_ORGANIZATION_LOGO;
    
    			$logo_image_url_absolute = $_SERVER['DOCUMENT_ROOT'] . parse_url(YASR_BLOGPOSTING_ORGANIZATION_LOGO, PHP_URL_PATH);
    
    			$post_image_size = @getimagesize($logo_image_url_absolute);  //the @ should be useless, just to be safe
    
    			$logo_image_size = @getimagesize($logo_image_url_absolute);  //the @ should be useless, just to be safe
    
    		}
    
    		else {
    
    			$post_image_size[0] = 0;
    			$post_image_size[1] = 0;
    
    			$logo_image_size[0] = 0;
    			$logo_image_size[1] = 0;
    
    		}
    
    		//if exists featuread image get the url and overwrite the variable
    		if (has_post_thumbnail() ) {
    
                $post_image_url =  wp_get_attachment_url(get_post_thumbnail_id());
    
    			$post_image_url_absolute = $_SERVER['DOCUMENT_ROOT'] . parse_url($post_image_url, PHP_URL_PATH);
    
    			$post_image_size = @getimagesize($post_image_url_absolute);  //the @ should be useless, just to be safe
    
    		}
    
    		if ($review_choosen == "Product") {
    
    			$rich_snippet["@type"]="Product";
    
    		}
    
    		elseif ($review_choosen == "Recipe") {
    
    			$rich_snippet["@type"]="Recipe";
    
    			$rich_snippet["image"] = array(
    				"@type" => "ImageObject",
    				"url" => $post_image_url,
    				"width" => $post_image_size[0],
    				"height" => $post_image_size[1]
    			);
    
    		}
    
    		elseif ($review_choosen == "Place") {
    
    			$rich_snippet["@type"]="LocalBusiness";
    
    		}
    
    		elseif ($review_choosen == "Other") {
    
    			$rich_snippet["@type"] = "BlogPosting";
    
    			$rich_snippet["datePublished"] = $date;
    
    			$rich_snippet["headline"] = $review_name;
    
    			$rich_snippet["mainEntityOfPage"]  = array(
    				"@type" => "WebPage",
    				"@id" => get_permalink()
    			);
    
    • This topic was modified 8 years, 6 months ago by darkcrizt.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Error in Structured Data Testing Tool’ is closed to new replies.