--- layout: wiki title: TracNavigation updated: 2021-04-16 08:14 author: trac default: true --- ## Trac Navigation The main and meta navigation entries can be customized in several ways. The \`mainnav\` and \`metanav\` configuration sections can be used to customize the navigation item text and link, change the ordering of the navigation items, disable them and add new ones. The primary attributes that can be customized are \`href\`, \`label\`, \`order\` and \`permission\`. #### \`mainnav\` #mainnav-bar \`mainnav\` corresponds to the **main navigation bar**, the one containing entries such as *Wiki*, *Timeline*, *Roadmap*, *Browse Source* and so on. This navigation bar is meant to access the default page of the main modules enabled in Trac that are accessible for the current user. \*\* Example \*\* In the following example we rename the link to [WikiStart](/briareus/notes/WikiStart/) //Home//, and make the //View Tickets// entry link to a specific report. ```ini [mainnav] wiki.label = Home tickets.href = /report/24 ``` Note the entries on the main navigation are displayed in uppercase regardless of the casing of the \`label\`, unless this aspect of the styling is overridden through interface customization. #### \`metanav\` #metanav-bar \`metanav\` corresponds to the **meta navigation bar**, by default positioned above the main navigation bar and below the *Search* box. It contains the *Login*, *Logout*, *\!Help/Guide* etc. entries. This navigation bar is meant to access some global information about the Trac project and the current user. There is one special entry in the \`metanav\` section: \`logout.redirect\` is the page the user sees after hitting the logout button. The *\!Help/Guide* link is also hidden in the following example. *[comment(see also #Trac3808)]* \*\* Example \*\* ```ini [metanav] help = disabled logout.redirect = wiki/Logout ``` #### Extra Navigation Entries #nav-extra-entries New navigation entries can be arbitrarily defined and added to the navigation. A new entry can be defined by providing a name with value \`enabled\`. At a minimum, the \`href\` attribute should be specified to define a useful navigation entry. If the \`label\` attribute is not defined the entry's name will be used for the label. The following example creates two new navigation items, one named //My Reports// and the other named //builds//. //My Reports// is only visible to users with \`REPORT_VIEW\` permission. ```ini [mainnav] myreports = enabled myreports.href = /report/9 myreports.label = My Reports myreports.permission = REPORT_VIEW [metanav] builds = enabled builds.href = https://travis-ci.org/edgewall/trac ``` The entry names are always read as lowercase, as is the case for all keys in the trac.ini file due to the way the configuration parser is configured. If the example above used \`BUILDS\` rather than \`builds\` for the name, the entry would still be displayed as \`builds\`. Use the \`label\` attribute for case-sensitive customization of the navigation entry text. #### Relocating Entries #nav-relocating-entries Navigation entries provided by Trac and plugins can be moved from the meta navigation bar to the main navigation bar, and vise-versa. The entry should be defined in the desired category as if it was a new entry. For example, to move the //Admin// entry to the metanav and rename it to //Administration//: ```ini [metanav] admin = enabled admin.label = Administration ``` Attributes of the navigation item that are not overridden by the configuration will be preserved. #### URL Formats Possible URL formats for \`.href\` or \`.redirect\`:
| **config** | **redirect to** |
| \`wiki/Logout\` | \`/projects/env/notes/Logout\` |
| \` | \` |
| \`/projects\` | \`/projects\` |