Manual:LinkRenderer.php

is a class to create HTML links for a specific title. It was refactored out of the Linker class in MediaWiki 1.28.

Getting a LinkRenderer instance
In general, the easiest way to get a  instance is from  : This will provide you with an instance prepared for the current user.

Some contexts will have their own LinkRenderer instance, like the Parser or SpecialPages: If you need to set custom options (see below), you can create your own! You shouldn't modify the main instances since that will affect the entire request state.

Making links
Okay, you now have a LinkRenderer instance. Let's make some links! At the very minimum you'll need a  or   target to link to. Will give you: If you want to change the link text: This text will automatically be escaped, (different from it's Linker predecessor). If you need to include HTML, you can armor the content:

Options
LinkRenderer has a few options that are set per-instance and can be customized:
 * ForceArticlePath ( / ): Forces the link to use the article path (see ) even if a query string is present, resulting in URLs like.
 * ExpandURLs ( / ): Controls whether the URL should be expanded, and can be set to any of the  constants.
 * StubThreshold ( / ): Threshold at which articles should be marked with the  CSS class. Using   will automatically set this.