• when i use the function bcn_display_nested, the first item is displayed twice

    example: Home > Home > category > my post

    when i use bcn_display it works fine

    example: Home > category > my post

    i tried to uncheck display home url in breadcrumbs settings, now i have the category twice

    example: category > category > my post

    is there a solution for this or am i missing something

    note: the normal bcn_display function works fine except bcn_display_nested which is returning the above results

    thanks in advance

    https://www.ads-software.com/extend/plugins/breadcrumb-navxt/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author John Havlik

    (@mtekk)

    The display_nested function is broken, the way it was originally implemented is sort of “half baked”. I can’t say if it will be fixed in 4.0 or if it will be later.

    Honestly, I am not a fan of either of the microdata/rdfa formats as they provide a ridiculous amount overhead and duplicate data.

    Thread Starter Naji Amer

    (@n-for-all)

    if it exists then it should work, it is not good for the reputation of the plugin that the function exist but doesn’t work, if it doesn’t exist at all it is much better.

    also the microdata and rdfa is the future of the internet and it is getting wider to use schema.org, and also the a similar schema is being used socially with open graph protocol.

    you have to implement this feature, i hope that will be fixed in version 4

    thank you for your reply

    Same problem here. The display_nested function can be tweaked a bit to get it to work according to the Google spec, but the “displayed-twice” problem is difficult to troubleshoot in the code and is a showstopper for me.

    Everyone is trying to use the microdata/rdfa format these days to allow Google to properly recognize the site breadcrumbs and display as such on the search results. It would be unwise to ignore it in your upcoming version.

    I’ll spend another hour or so trying to troubleshoot this issue, but if I can’t fix it, will try Yoast Breadcrumbs. That plugin seems to handle the microdata decorations properly.

    Here is my solution. I really hated modifying the original code but for what’s it’s worth, it now works correctly.

    1. Open breadcrumb_navxt_class.php for editing.
    2. In function display_nested replace this block:

    if($mode === 'rdfa')
    {
    	//Start up the recursive engine
    	$trail_str = sprintf('<%1$s typeof="v:Breadcrumb">%2$s %3$s</%1$s>', $tag, $breadcrumb->assemble($linked), $this->nested_loop($linked, $tag, $mode));
    }
    else
    {
    	//Start up the recursive engine
    	$trail_str = sprintf('%2$s %3$s', $tag, $breadcrumb->assemble($linked), $this->nested_loop($linked, $tag, $mode));
    }

    with this one:

    //Start up the recursive engine
    $trail_str = $this->nested_loop($linked, $tag, $mode);

    3. In function nested_loop replace this block:

    if($mode === 'rdfa')
    {
    	return sprintf('%1$s<%2$s rel="v:child"><%2$s typeof="v:Breadcrumb">%3$s%4$s</%2$s></%2$s>', $this->opt['separator'], $tag, $breadcrumb->assemble($linked), $this->nested_loop($linked, $tag, $mode));
    }
    else
    {
    	return sprintf('%1$s<%2$s itemprop="child" itemscope itemtype="https://data-vocabulary.org/Breadcrumb">%3$s%4$s</%2$s>', $this->opt['separator'], $tag, $breadcrumb->assemble($linked), $this->nested_loop($linked, $tag, $mode));
    }

    with this one:

    $separator = '';
    $rel = '';
    if ($key !== count($this->trail) - 1)
    {
    	$separator = $this->opt['separator'];
    	$rel = ($mode === 'rdfa') ? 'rel="v:child"' : 'itemprop="child"';
    }
    if($mode === 'rdfa')
    {
    	return sprintf('%1$s<%2$s ' . $rel . '><%2$s typeof="v:Breadcrumb">%3$s%4$s</%2$s></%2$s>', $separator, $tag, $breadcrumb->assemble($linked), $this->nested_loop($linked, $tag, $mode));
    }
    else
    {
    	return sprintf('%1$s<%2$s ' . $rel . ' itemscope itemtype="https://data-vocabulary.org/Breadcrumb">%3$s%4$s</%2$s>', $separator, $tag, $breadcrumb->assemble($linked), $this->nested_loop($linked, $tag, $mode));
    }

    Hope this helps! I don’t claim this to be the “proper” fix, but it does the job until mtekk comes up with a permanent solution.

    Plugin Author John Havlik

    (@mtekk)

    Everyone is trying to use the microdata/rdfa format these days to allow Google to properly recognize the site breadcrumbs and display as such on the search results. It would be unwise to ignore it in your upcoming version.

    The sad thing about this is I have not seen microformats improve Google’s ability to generate breadcrumbs in its results. The biggest thing since the introduction of the breadcrumbs in search results is Google changed from supporting something using a class set to breadcrumb, to supporting only a class set to breadcrumbs (at least from what I have seen).

    To fully follow either spec, you have to set some prefixes and suffixes correctly, which can be a real pain in the butt. In a future release there will be a “push button” configuration for these two cases. Since I am taking the opportunity to change up the settings in 4.0 (fewer, but more powerful settings), implementing this earlier would be wasted effort.

    Thread Starter Naji Amer

    (@n-for-all)

    i don’t know about your solution but breadcrumbs works perfectly without modifying the code and the google test tool reads the micro data just fine from my page

    i use : bcn_display_nested(false,true,’span’,”);

    the only problem is “Home” displayed twice in the trailer and that’s annoying, i debugged the code and i can manage to remove it by a condition check.
    “The sad thing about this is I have not seen microformats improve Google’s ability to generate breadcrumbs in its results.”

    you never know what google is up too, we got the panda algortihm after google published it and it was a disaster for some of the biggest websites, frankly i think google is using microdata formats to crawl the site in an ordered way and to build his own sitemap from those trails.

    the only problem is “Home” displayed twice in the trailer and that’s annoying

    @n-for-all, my solution IS about removing the extra “Home” link. I thought that’s why you started this thread to begin with. ??

    There is one other bit there about removing the itemprop="child" from the first span, but that’s minor.

    You can see my version here: https://www.learncomputer.com/.

    @mtekk, I totally hear you. I doubt too many people are actually using the bcn_display_nested. I just came across it because I found it in your changelog and wanted to try it. ??

    Thread Starter Naji Amer

    (@n-for-all)

    i tried your solution but nothing changed, that’s why i though you were probably fixing the microdata format instead of the “displayed-twice” trail.

    i still see the home link displayed twice.

    I assure you it works! Just make sure you fully replace the original code with mine in both places (I can send you the entire two functions – nested_loop and display_nested if you tell me where to).

    The sprintf('%1$s<%2$s itemprop="child" itemscope itemtype="https://data-vocabulary.org/Breadcrumb">%3$s%4$s</%2$s>', $this->opt['separator'], $tag, $breadcrumb->assemble($linked), $this->nested_loop($linked, $tag, $mode)); statement inside display_nested function is the one causing the repeat of the first item (which is also added inside the nested_loop function). Once you remove it, the duplicate will be gone.

    The only problem is you will have an extra separator at the front of your breadcrumb, which is removed by my code in nested_loop.

    Thread Starter Naji Amer

    (@n-for-all)

    send me the whole file and i will upload it and replace the old one.

    breadcrumb_navxt_class.php

    maybe i am missing something, i already replaced what you said

    where would you like the file sent?

    Thread Starter Naji Amer

    (@n-for-all)

    upload it somewhere so that i and others can download it, maybe rapidshare.com or megaupload.com

    Thread Starter Naji Amer

    (@n-for-all)

    ok great, it works now, i uploaded the file and replaced the old one

    thanks a lot

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Plugin: Breadcrumb NavXT] display Microdata and rdfa (rich snippets)’ is closed to new replies.