1

Sometimes Wikipedia or some other non-Wikimedia Foundation wiki will have an article with the same page title, about the same subject but from a different perspective.

Like Wikipedia does for articles in other language versions. How to have links appear at the bottom of the sidebar when another wiki (from a selection) has an article with the same title?

e.g. An article on the local wiki called Ethernet will then have links to Wikipedia and Altera Wiki, while an article called Prototype X-37 doesn't because there is no such page on those wikis.

  • Not trying to be a smartie-pants, but this sounds like you need your programmer hat. There are no mechanisms that I am aware of for this. Just make sure you do not grab your tin-foil hat- that is for listening to Jesse Ventura. – closetnoc Oct 13 '14 at 17:51
2

To use the functionality built into Wikipedia you would have to have all of the Wikis belong to the same Wiki family.

Since your local Wiki is unlikely to be part of the Wikipedia family you could instead solve this with JavaScript, CSS and templates.

As an example creating a sidebar link to Wikipedia would require:

  1. Create a template (e.g. Template:iwWikipedia) with:

    <div class="interProject wikipedia" style="display:none;">[//en.wikipedia.org/wiki/{{{1|{{PAGENAMEE}}}}} Wikipedia]</div>
    
  2. Add the following to your MediaWiki:Common.css

    ul.interProject { 
      list-style: none;
      padding-left: 0; 
      margin-left: 0;
    }
    
    li.interProject,
    /* for Vector skin since the above doesn't take for some reason */
    #mw-panel div.portal div.body ul.interProject li.interProject { 
      background-repeat: no-repeat;
      background-position: left center;
      padding-left: 18px; 
      margin-left: 0;
    }
    
    li.wikipedia {
      background-image: url("//upload.wikimedia.org/wikipedia/commons/thumb/6/63/Wikipedia-logo.png/14px-Wikipedia-logo.png");
    }
    
  3. Add the following to your MediaWiki:Common.js

    /**
     * Adds interwikilinks to other projects in the left sidebar.
     */
    $( function() { 
        var iwlinks = jQuery( 'div.interProject' );
        if ( iwlinks.length > 0 ) {
            var pproject = jQuery( '#p-tb' ).clone().attr( 'id', 'p-project' ).insertAfter( '#p-tb' );
            pproject.find( 'h3' ).attr( 'id', 'p-project-label' ).text( 'On other projects' );
            pproject.find( 'ul' ).addClass( 'interProject' ).empty().append( iwlinks );
            iwlinks.replaceWith( function() {
                return $( '<li></li>' ).addClass( $(this).attr( 'class' ) ).append( $(this).contents() );
            });
        }
    });
    

Now adding {{iwWikipedia}} anywhere in your Ethernet article will add a link to the Ethernet article on English Wikipedia. If the articles don't have the same name simply add the desired name as an extra parameter e.g. {{iwWikipedia|Hello_World}} (with spaces replaced by underscores).

  • Wow, great answer! This ought to be a MediaWiki extension. Thanks. – Rob Kam Oct 14 '14 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.