• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Logo

impressive pages: Webdesign und eCommerce

  • Home
  • Blog
  • Hosting
  • Contact

SEO

Solution for Google Search Console – Message: “brand” field is missing

22. December 2021 Leave a Comment

Feld "brand" fehlt

If you run a shop with WooCommerce you have certainly already discovered the message opposite in Google Search Console under Improvements -> Products.

By default, the WooCommerce plugin for WordPress does not add the “Brand” scheme to WooCommerce product pages. That means there is a loophole in the WooCommerce schema.

Various support threads on WordPress.org and Github say that this can be solved by buying a WooCommerce plugin. With something as basic as this one can be very frustrating, and rightly so.

Ultimately, WooCommerce’s justification is that these are not essential parts of the schema – they only generate warnings in the Google Search Console, but not errors. So in theory, they’re not a big deal.

However, if you want to close this loophole, you have several options. There are “schema plugins” out there to help you patch this up – the Yoast SEO WooCommerce plugin fills the gaps for you – but it is a bit of an exaggeration to spend around 70 euros a year for this. Unless you have or need it for another important reason. Then these instructions will help.

Many people avoid code-based solutions because they have to be “maintained” and break regularly. So for an ecommerce website that makes you money, that’s not great!

Google Search Console fix code – brand field warning

With the Code Snippets plugin , small code snippets like the following can be integrated into the page. Professionals have a separate plug-in for such adjustments or use the functions.php of their theme.

/*
* Füge "Brand"-Schema in die Strukturierten Daten ein
*/
function custom_woocommerce_structured_data_product ($data) {
	global $product;
	$data['brand'] = ['@type' => 'Brand', 'name' => 'Meine Marke'];
	return $data;
}
add_filter( 'woocommerce_structured_data_product', 'custom_woocommerce_structured_data_product' );

If you are the manufacturer of your products or if you only sell goods from one brand, you can insert your brand here instead of ” My brand ” (quotation marks must remain).

Alternatively, the brand can also be extracted from the Brand property with $ product-> read out get_attribute (‘pa_brand’) .

The code snippet would then look like this:

/*
* Füge "Brand"-Schema in die Strukturierten Daten ein
*/
function custom_woocommerce_structured_data_product ($data) {
	global $product;
        $data['brand'] = ['@type' => 'Brand', 'name' => $product->get_attribute('pa_brand') ?? null];
	return $data;
}
add_filter( 'woocommerce_structured_data_product', 'custom_woocommerce_structured_data_product' );

I am using a manufacturer’s product property for a customer. Therefore I set the “Brand” field with the manufacturer with the command $ product-> get_attribute (‘pa_manufacturer’) .

To test the success, use the practical online tool from Google: Test structured data .

Filed Under: Google Search Console, SEO, WooCommerce

What is the meaning of ‘schema “data-vocabulary.org” deprecated’?

22. December 2021 Leave a Comment

SEO

Google is currently sending out warnings about navigation path problems through Search Console recognized “.

With this, Google would like to point out that they are concentrating on the schema.org schema when developing the crawler and no longer support metadata from the outdated namespace data-vocabulary.org .

Google made the change on April 6, 2020. Since then, only the more widely used schema.org schema has been supported by the search engine.

What are structured data such as schema.org ?

Structured data are instructions to search engines about the specific meaning of data and how it relates to other data.

Without becoming too theoretical: This means that data can be given separately on one page. In the case of an eShop, for example, the title, article number, price, etc. can be given to the search engine without the crawler having to read out the information in the text on the page. The latter is not that easy at all. This might still be possible with prices, but with article numbers the question arises where it is and what does it look like. In order to solve the problem exactly, there is structured data (see also ontology at Wikipedia ).

Do I have to do something about it?

It is not entirely clear to me who exactly receives the message. Maybe they all get webmasters. If you have received this message, it does not mean that you have an acute problem.

If the CMS / ESHOP or the SEO plugin that you are using supports schema.org metadata, then you do not need to do anything else. If it is a current version, this should be the case. The developers of an actively developed system are usually in the know and develop the software according to the current standards.

To test structured data on your own data, Google offers the online tool to test structured data (external link). If data about products (in the case of an online shop), such as titles, prices, etc. appear, everything is fine.

The current version of WooCommerce supports the schema.org schema. WordPress can be supplied with structured data according to schema.org with the help of YOAST SEO. Further information is available from YOAST under this link: Structured data with Schema.org: the ultimate guide (external link).

Would you like to find out more about the topic? You can find another article on the subject at t3n.de (external link).

Filed Under: Google Search Console, SEO

WooCommerce product description (full product description) as a meta description in WordPress

22. December 2021 Leave a Comment

With the help of YOAST it is possible to display the product description as a meta description. This is done in the programmatic way as follows:

Insert the following code as a snippet in functions.php of the theme or using a plugin.

// callback für Ersetzung in YOAST SEO 
function get_fullDescription() {
    global $post;
    return $post != null ? $post->post_content : "";
}

// Registriere eigene YOAST-Variablenersetzung
function register_custom_yoast_variables() {
    wpseo_register_var_replacement( '%%fulldes%%', 'get_fullDescription', 'advanced', 'Full Description' );
}

// YOAST-Variablenersetzung bekannt machen
add_action('wpseo_register_extra_replacements', 'register_custom_yoast_variables');

Then under WordPress -> SEO -> Presentation in search results -> Enter products %%fulldes%% under meta description. Don’t forget to save!

Under SEO -> Presentation in search results -> P roducts -> Enter meta description %%fulldes%% . YOAST replaces the variable with the variable name.

But now the complete description is used. However, it would be better to observe the length specification for meta descriptions of the search engines. This is a maximum of 160 characters.

For this we need two more functions. With the replaceHtmlTags function below, we replace any existing HTML tags in the description, because we don’t want them in our meta description. With the second function wordTruncate we reach the length specification. The code ensures that it is not just separated after 160 characters and thus possibly cut off in the middle of the word, but that it is cut off after the last word that is still within the 160 characters.

function replaceHtmlTags($string) {
	return preg_replace("/<.*?>/", "", $string);
}

function wordTruncate($string, $desired_max_width) {
  $parts = preg_split('/([\s\n\r]+)/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
  $parts_count = count($parts);

  $length = 0;
  $last_part = 0;
  for (; $last_part < $parts_count; ++$last_part) {
    $length += strlen($parts[$last_part]);
    if ($length > $desired_max_width) { break; }
  }

  return implode(array_slice($parts, 0, $last_part));
}

The routine get_fullDescription from the code above is modified again a bit and looks like this:

// callback für Ersetzung in YOAST SEO 
function get_fullDescription() {
    global $post;
    return wordTruncate(replaceHtmlTags($post->post_content), 160);
}

The complete code looks like this:

// callback für Ersetzung in YOAST SEO 
function get_fullDescription() {
    global $post;
    return wordTruncate(replaceHtmlTags($post->post_content), 160);
}

// Registriere eigene YOAST-Variablenersetzung
function register_custom_yoast_variables() {
    wpseo_register_var_replacement( '%%fulldes%%', 'get_fullDescription', 'advanced', 'Full Description' );
}

// YOAST-Variablenersetzung bekannt machen
add_action('wpseo_register_extra_replacements', 'register_custom_yoast_variables');

function replaceHtmlTags($string) {
	return preg_replace("/<.*?>/", "", $string);
}

function wordTruncate($string, $desired_max_width) {
  $parts = preg_split('/([\s\n\r]+)/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
  $parts_count = count($parts);

  $length = 0;
  $last_part = 0;
  for (; $last_part < $parts_count; ++$last_part) {
    $length += strlen($parts[$last_part]);
    if ($length > $desired_max_width) { break; }
  }

  return implode(array_slice($parts, 0, $last_part));
}

Thus, without the chargeable YOAST SEO WooCommerce extension, we have managed to display the product description as a meta description.

WooCommerce short description as meta description

If, on the other hand, you want to use the short description as a meta description, YOAST SEO offers the function in the free version, albeit a bit hidden.

To use the short description as a meta description, under SEO -> Presentation in search results -> Products include the %%wc_shortdesc%% variable.

Good luck with your SEO project!

Do you have any further questions or need support, I would be happy to assist you. Write to me without obligation or give me a call.

contact impressive pages

Filed Under: SEO, WooCommerce, WordPress

Primary Sidebar

Search

Recent Posts

  • WooCommerce: Show free shipping only
  • Remove wrapper DIVs (.wrap) in Genesis
  • Remove the number of products in the category list from the category name
  • Change the number of similar products in WooCommerce
  • Genesis Visual Hook Guide

Categories

  • development
  • Genesis framework
  • Google Search Console
  • mobile
  • SEO
  • Uncategorized
  • Web hosting
  • WooCommerce
  • WordPress

Archives

  • May 2022
  • January 2022
  • December 2021
  • imprint
  • Data protection

Footer

!pages
Heinrich Franz
Wilhelm-Martin-Str. 4
76356 Weingarten (Baden)
instagram
+49 160 85 40 725
info@impressive-pages.de

In my Blog I publish articles about WordPress, Genesis framework und SEO.

© 2022 impressive pages

  • Deutsch