Search code examples
trac

How can I add a menu of local Trac projects to templates/site.html?


I have multiple Trac projects with different environments on the same server. I would like to have a list of links to all projects at the top of each project page so I can quickly switch between them with out having to go up to the top level list at /projects/.

The ideal solution would:

  1. not require loading all the Trac environments on every page load.
  2. update automatically when a new project is added.
  3. only require editing the config and/or templates or add a plugin.
  4. work for Trac 0.11.

Solution

  • The NavAddPluggin allows the main trac navigation bar to be customized. You could add menu options for each trac of your projects. To add a new menu item the following is added to the trac.ini file.

    [navadd]
    add_items = project1
    project1.target = mainnav
    project1.title = Project One
    project1.url = http://webserver/trac_project_1
    

    To sort the order edit the mainnav option in the trac.ini

    mainnav = project1,wiki,timeline,roadmap,browser,tickets,newticket,search