Version 40 (modified by moschny, 13 years ago) (diff)

Answering all those questions.

TracNav: The navigation bar for Trac

The [[TracNav]] macro implements a fully customizable navigation bar for the Trac wiki engine. The contents of the navigation bar is a wiki page itself and can be edited like any other wiki page through the web interface. The navigation bar supports hierarchical ordering of topics. The design of TracNav mimics the design of the TracGuideToc that was originally supplied with Trac. The drawback of TracGuideToc is that it is not customizable without editing its source code and that it does not support hierarchical ordering.

A life example of TracNav can be seen on the right. Please use this navigation bar to learn more about TracNav.

If you just want to play around with TracNav, please use the SandBox!

Comment by cboos@… on Wed Mar 2 19:28:09 2005

Excellent idea''
-- CB

Comment by reinhard.brandstaedter at on Thu Jul 14 10:44:50 2005

Great stuff! But I'm wondering how to use multiple hierarchies in the navigation with links enabled. In your Nav: "See also" as heading "TracNav" as subheading with link-function "Overview" as subsubheading with link function

Is this possible? Everytime I add a child-link tocentry under a link this link is not displayed.


Comment by pellatt@… on Sat Jul 16 11:56:43 2005

I'd like to use this for making a few quick links to things like current milestones and reports, any chance of adding that functionality?


available since r3057, and also in Release 3.2 to the MacroBazaar
-- Thomas

Comment by christophe on Thu Aug 4 18:09:10 2005

ceci est un test, merci pour votre travail ;)

Comment by sewerson on Fri Aug 19 21:32:45 2005

TracNav always responds with Error: Macro TracNav(TOC) failed not all arguments converted during string formatting somehow buggy code

TracNav works with Trac >= version 0.9 since r3044 resp. Release 3 to the MacroBazaar
-- Thomas

Comment by anonymous on Mon Nov 21 19:56:18 2005

How about support for inline navigation?

Comment by jose@… on Thu Feb 9 09:05:07 2006

OK I give how do I download this? I click on the links and they show the code embedded in a webpage but no way to actually download the code

Comment by jose@cybergalvez on Thu Feb 9 09:15:22 2006

Sorry about the previous comment I figured it out

Comment by anonymous on Sun Feb 19 22:46:31 2006

I'd like to force TracNav to show the entire TOC in all cases, without collapsing or formatting some captions bold+black. Is there any way to do this?

You may try to remove the call to the filter_toc function. In line 218, replace

(found, filtered) = filter_toc(curpage, toc, 0)


(found, filtered) = (0, toc)

This will display the TOC alway fully expanded like in the TOC edit mode. If you now really do not like bold face for headings, you can experiment with the line 82 in wiki.css:

Try to add to

.wiki-toc.trac-nav h4 { margin: 0; padding: 0; }

the style you like for headings, e.g.

.wiki-toc.trac-nav h4 { margin: 0; padding: 0; font-weight: normal; }

I did not try this recipe myself, you might have to experiment a little. Regards,

Since r3088, TracNav knows the nocollapse argument, which prevents the TOC from being sorted or collapsed.

Comment by TomB on Fri Jun 9 14:29:19 2006

Hi together :)

My installation doesn't work as it should ;( I'm using version 0.8.1. I've downloaded the right package imho and followed the instructions on this site (

But it always says: Error: Macro TracNav(None) failed invalid syntax (, line 1)

Any suggestions? Many Thx!

The latest TracNav packages will not work with Trac 0.8. Either update Trac, or try one of the older versions, see log:trac/trunk/wiki-macros/

Comment by eliott on Mon Jul 17 10:10:33 2006

Is there a way to get the tracnav to show on the left side of a page, instead of the right?

Add something like .wiki-toc.trac-nav { float: left; margin: 0 .5em 0 0;} to the site_css.cs file of the templates directory of your project.

Comment by anonymous on Fri Aug 18 18:28:41 2006

I suggest to to use 'WikiStart' instead of an empty string as the second Parameter of the getValue call in the 'curpage = ...' line in the execute method. This allows for using a Link to the WikiStart page in the TOC and a Link without a page name will properly be identified as the WikiStart page. (Compare this to your javascript hack on your WikiStart page).

Done in [3106] resp. 3.92pre6. Thanks for suggesting it!

Comment by anonymous on Mon Aug 21 07:30:26 2006

I'm feeling a little stupid, but given that I'm just starting out with Trac I guess I'm entitled to that. ;)

How do I change the actual title text of the NavBar? The examples here don't have a title, but my basic installation has a large text 'TracNav menu' across the top, which is bigger than my menu and looks pretty weird.

Any help appreciated.

This sounds to me as if TracNav's stylesheet were missing. You have to set PYTHON_EGG_CACHE to a directory writable by the webserver. See

P.S.: It would be nice to have a repository for style tricks, i.e. how to get the NavBar as a full menu on the left, instead of a box like in Feb 19 comment above.

Comment by Paulo on Wed Aug 23 18:00:35 2006

Is there any available version for Python 2.3?

No, because we don't have Python 2.3 here. But you can easily build it yourself from the zipfile provided on the download page.