Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: briggz5d on January 27, 2020, 06:47:35 AM

Title: data-vocabulary.org schema deprecated 20th Jan - changing to Schema.org
Post by: briggz5d on January 27, 2020, 06:47:35 AM
Hi guys,

I've ignored Googles webmaster warnings emails about Breadcrumbs issues detected for a few days now.
I;ve noticed a drop in landing pages and analytics also notified me of a drop in earnings. So i've made out time today to fix the depreciated schema but dont know how :D

Can someone look into this and maybe provide an easy Copy / Paste solution so i dont go messing with code doing trial and error.
Will SMF maybe role out a small fix before april 6th when the depreciated schema will no longer be accepted as google rich result feature ? 
Title: Re: data-vocabulary.org schema deprecated 20th Jan - changing to Schema.org
Post by: vbgamer45 on January 27, 2020, 07:19:30 AM
What version of SMF are you on?
Title: Re: data-vocabulary.org schema deprecated 20th Jan - changing to Schema.org
Post by: briggz5d on January 27, 2020, 07:29:39 AM
I'm on version 2.0.15 but i see now that version .17 is available.. Let's see if that's a fix
Title: Re: data-vocabulary.org schema deprecated 20th Jan - changing to Schema.org
Post by: Douglas on January 27, 2020, 07:38:16 AM
I'm digging into this for you, now. I'm scanning both 2.1 RC2 and 2.0.15 forums. Will report back in a second. I'll also check 2.0.17, as well.
Title: Re: data-vocabulary.org schema deprecated 20th Jan - changing to Schema.org
Post by: Douglas on January 27, 2020, 07:57:35 AM
Okay, scanned:
2.0.15
2.0.17
2.1 RC2.

None of them, out of the box, use data-vocabulary.org (which is what's being "retired").

I would take a look at any mods or custom themes you've got installed (this eliminates SMF, itself, as the "culprit". :))
Title: Re: data-vocabulary.org schema deprecated 20th Jan - changing to Schema.org
Post by: briggz5d on January 27, 2020, 09:11:33 AM
I Found the culprit on my custom Theme.

// Each tree item has a URL and name. Some may have extra_before and extra_after.
   foreach ($context['linktree'] as $link_num => $tree)
   {
      echo '
         <li', ($link_num == count($context['linktree']) - 1) ? ' class="last"' : '', ' itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">';

      // Show the link, including a URL if it should have one.
      echo $settings['linktree_link'] && isset($tree['url']) ? '
            <a href="' . $tree['url'] . '" itemprop="url"><span itemprop="name">' . $tree['name'] . '</span></a>' : '<span itemprop="name">' . $tree['name'] . '</span>';

      echo '
         </li>';
   }
   echo '
      </ol>';

   $shown_linktree = true;
}


Might take me the whole day to get correctly, help?
Title: Re: data-vocabulary.org schema deprecated 20th Jan - changing to Schema.org
Post by: Douglas on January 27, 2020, 11:03:15 AM
Search for:
itemtype="http://data-vocabulary.org/Breadcrumb"

Replace with:
itemtype="http://schema.org/BreadcrumbList"

If that's the only place you've found it, the fix is rather quick and painless, and only needs to be done once. :)

Pay attention to the Breadcrumb/BreadcrumbList portion. That part is case sensitive, so make sure you copy/paste my exact code.
Title: Re: data-vocabulary.org schema deprecated 20th Jan - changing to Schema.org
Post by: vbgamer45 on January 27, 2020, 11:39:43 AM
On my forums I use this
function theme_linktree($force_show = false)
{
global $context, $settings, $options, $shown_linktree, $scripturl;

// If linktree is empty, just return - also allow an override.
if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
return;

echo '
<div class="navigate_section">
<ul itemscope itemtype="https://schema.org/BreadcrumbList">';

$linkpos = 1;

// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
echo '
<li', ($link_num == count($context['linktree']) - 1) ? ' class="last"' : '', ' itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">';

// Show something before the link?
if (isset($tree['extra_before']))
        {
echo $tree['extra_before'];

        }
// Show the link, including a URL if it should have one.
echo $settings['linktree_link'] && isset($tree['url']) ? '
<span><a href="' . $tree['url'] . '"  itemprop="item"><span itemprop="name">' . $tree['name'] . '</span></a></span>' : '<span><a href="' . $scripturl . '"  itemprop="item"><span itemprop="name">' . $tree['name'] . '</span></a></span>';

// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];

// Don't show a separator for the last one.
if ($link_num != count($context['linktree']) - 1)
echo ' »';

echo '<meta itemprop="position" content="' . $linkpos . '" />
</li>';

$linkpos++;
}
echo '
</ul>
</div>';

$shown_linktree = true;
}