Page MenuHomePhabricator

Crumbs contain (disambiguation) in names which duplicates locations already in breadcrumb path
Open, NormalPublic

Description

Author: carlb613

Description:
Moving this issue from [[voy:Wikivoyage talk:Breadcrumb navigation#Remove parenthesis at display]]...

In [[voy:Hamilton (Ohio)]], the GeoCrumb trail looks like:

North America > United States of America > Midwest (United States of America) > Ohio > Southwest Ohio > Butler County (Ohio) > Hamilton (Ohio)

This is redundantly redundant; the same path could be expressed succinctly as:

North America > United States of America > Midwest > Ohio > Southwest Ohio > Butler County > Hamilton

We already _know_ this is in Ohio because " > Ohio > " is in the trail, so any " (Ohio)" disambiguators in the town and county names can be hidden from the user without losing anything useful.

The breadcrumb trail is generated in GeoCrumbs.class.php in function makeTrail().

Adding code to this function to keep a $nameStack of place names already in the path and then hiding these where they appear in (brackets) elsewhere in the same trail would give:

public function makeTrail( Title $title ) {
        $breadcrumbs = array();

        // avoid cyclic trails & define emergency break
        $nameStack = array();
        $idStack = array();
        $cnt = 20;

        while ( $title && $cnt-- ) {
                $link = Linker::link( $title, $title->getSubpageText() );

                // mark redirects with italics.
                if ( $title->isRedirect() ) {
                        $link = Html::rawElement( 'i', array(), $link );
                }
                array_unshift( $breadcrumbs, $link );

                if ( in_array( $title->getArticleID(), $idStack ) ) {
                        $breadcrumbs[0] = Html::rawElement( 'strike', array(), $breadcrumbs[0] );
                        break;
                }

                $nameStack[] = $title->getText();
                $idStack[] = $title->getArticleID();
                $title = $this->getParentRegion( $title );
        }

        // hide (disambiguator) in displayed titles if already in path
        foreach ($nameStack as $bname) {
                foreach ($breadcrumbs as &$crumb)
                   $crumb = str_replace(" (" . $bname . ")</a>","</a>",$crumb);
        }

        return $breadcrumbs;
}

Version: master
Severity: normal
URL: http://en.wikivoyage.org/wiki/Wikivoyage_talk:Breadcrumb_navigation#Remove_parenthesis_at_display

Details

Reference
bz43313

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 12:59 AM
bzimport added a project: GeoCrumbs.
bzimport set Reference to bz43313.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Dec 21 2012, 6:21 AM

Actually, there's no need to keep a stack of previous placenames. All disambiguators should be redundant within the context of a breadcrumb trail; they can just all be ignored.

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 25 2015, 12:10 PM

Oh, furthermore, the current pagename doesn't need to be displayed in the breadcrumb trail, since it appears immediately adjacent within the header.

Jdlrobson set Security to None.
Jdlrobson added a subscriber: Jdlrobson.

The patch seems to have stalled. Given it was raised back in 2012 I've removed the patch for review tag. I'll abandon it if I don't hear back from the owner....

This may be the bug that pushes me to actually get into MediaWiki development. How hard can it be?

Romaine added a subscriber: Romaine.

If this issue can be solved for Wikivoyage, this would finally improve the quality which is wished for for a long time.

Would be nice if we could re-use pipe trick code or something like that, but probably not.

Should we be stripping out all disambiguation parentheticals or just ones that appear higher up in the crumb list?

For example:
https://en.wikivoyage.org/wiki/Manhattan/Central_Park -> North America > United States of America > Mid-Atlantic > New York (state) > Metro New York > New York City > Manhattan > Manhattan/Central Park

Should (state) be included or stripped?

Should (state) be included or stripped?

Strictly speaking, it should probably be included.

In many cases (like Washington (state) or Georgia (country)) it's kind of silly to leave it in. There's no real chance of confusion. But if we strip it, we will have breadcrumb trails like this: Asia > East Asia > Japan > Kyushu > Miyazaki > Miyazaki -- which is confusing.

However, an important point: If we don't strip the disambiguator, we have to take that into account when back-searching for disambiguators in the breadcrumb trail. For example, our article is titled "Rochester (New York)", not "Rochester (New York (state))". If you just look for "New York" by itself in the breadcrumb trail, you won't find it.

Right. It seems like there's a lot of context required here...I'm not sure an automated solution is a good one. What if we allowed it to be controlled on the wiki, so you could do something like {{IsPartOf|New York (state)|New York}} to remove the parenthesis if that was wanted. It would require more manual work, but provide you with way more flexibility.

I see your point, but we did have the automated functionality on Wikitravel. Not sure how it's coded, but it works well:

http://wikitravel.org/en/Rochester_(New_York)
http://wikitravel.org/en/Miyazaki