MediaWiki Discussion: Sidebar: Difference between revisions
(Created page with "== Overview == The 'Sidebar' in MediaWiki is a critical component of the user interface, providing a navigational framework for users to access various parts of a wiki. This article delves into the intricacies of configuring and customizing the Sidebar, exploring its structure, functionality, and the best practices for optimizing its use. == Structure of the Sidebar == The Sidebar in MediaWiki is defined in the `MediaWiki:Sidebar` page, which is a system messa...") |
No edit summary |
||
Line 91: | Line 91: | ||
* [[DynamicSidebar]] | * [[DynamicSidebar]] | ||
[[Image:Detail-92691.jpg|thumb|center|Screenshot of a MediaWiki sidebar showing various navigation links.|class=only_on_mobile]] | |||
[[Image:Detail-92692.jpg|thumb|center|Screenshot of a MediaWiki sidebar showing various navigation links.|class=only_on_desktop]] | |||
== Categories == | == Categories == |
Latest revision as of 15:46, 20 June 2024
Overview
The 'Sidebar' in MediaWiki is a critical component of the user interface, providing a navigational framework for users to access various parts of a wiki. This article delves into the intricacies of configuring and customizing the Sidebar, exploring its structure, functionality, and the best practices for optimizing its use.
Structure of the Sidebar
The Sidebar in MediaWiki is defined in the `MediaWiki:Sidebar` page, which is a system message page. The content of this page is parsed and rendered as the navigation menu on the left-hand side of the screen. The Sidebar is composed of several sections, each containing a list of links. These sections can be customized to include links to internal pages, external websites, or special pages.
Default Sections
By default, the Sidebar includes the following sections:
- **Navigation**: This section typically includes links to the Main Page, Recent Changes, and Random Page.
- **Tools**: This section provides links to tools such as What Links Here, Related Changes, Upload File, and Special Pages.
- **Languages**: This section appears if the wiki has content in multiple languages, providing links to the same page in different languages.
Customizing the Sidebar
Customizing the Sidebar involves editing the `MediaWiki:Sidebar` page. The syntax for defining the Sidebar is straightforward but requires attention to detail to ensure proper functionality.
Syntax
The syntax for the Sidebar is as follows: ```
- section-name
- link|displayed text
- link|displayed text
``` Each section is defined by a line starting with an asterisk (*), followed by the section name. Links within the section are defined by lines starting with two asterisks (**), followed by the link target and the displayed text separated by a pipe (|).
Example
An example of a customized Sidebar might look like this: ```
- navigation
- mainpage|Main Page
- recentchanges-url|Recent Changes
- randompage-url|Random Page
- toolbox
- specialpages-url|Special Pages
- upload-url|Upload File
- languages
```
Advanced Customization
Advanced customization of the Sidebar can involve adding custom sections, utilizing MediaWiki extensions, and incorporating dynamic content.
Adding Custom Sections
To add a custom section, simply define a new section name and add the desired links. For example: ```
- custom-section
- custompage-url|Custom Page
- anotherpage-url|Another Page
```
Using Extensions
Several MediaWiki extensions can enhance the functionality of the Sidebar. For instance, the DynamicSidebar extension allows for the inclusion of dynamic content based on user roles or other criteria.
Dynamic Content
Incorporating dynamic content into the Sidebar can be achieved through the use of Parser functions and Magic words. For example, the following code adds a link that only appears for logged-in users: ```
- user-section
- {{#if:{{#ifeq:Template:USERID|0| |x}}|userpage-url|User Page}}
```
Best Practices
When customizing the Sidebar, it is essential to follow best practices to ensure usability and maintainability.
Usability
- **Consistency**: Maintain a consistent structure and naming convention for sections and links.
- **Relevance**: Include only relevant links to avoid cluttering the Sidebar.
- **Accessibility**: Ensure that the Sidebar is accessible to all users, including those using screen readers.
Maintainability
- **Documentation**: Document any customizations made to the Sidebar for future reference.
- **Testing**: Test the Sidebar on different devices and screen sizes to ensure it functions correctly.
- **Backup**: Regularly back up the `MediaWiki:Sidebar` page to prevent data loss.
See Also
![](/images/thumb/7/7f/Detail-92691.jpg/500px-Detail-92691.jpg)
![](/images/thumb/7/70/Detail-92692.jpg/500px-Detail-92692.jpg)