Version 16 (modified by moschny, 8 years ago) (diff) |
---|
Redirection for Trac
TracNav
See also
JavaParty...
uka.transport...
KaRMI...
Purpose and Usage
The [[redirect(type:id)]] wiki macro provides redirect functionality for Trac with backlink support. It takes a qualified TracLink as argument, e.g. wiki:SandBox, source:README or ticket:123. Users with a JavaScript-enabled browser will get redirected to the page specified by this shortlink.
Download and Installation
For Trac 0.11
This version of the plugin works with Trac 0.11. It is available here (version 0.11.2, release 08/14/08):
- Source: [source:/trac/plugins/redirect-0.11 Trac browser], anonymous SVN, ZIP archive
- Binary: Python 2.5 egg
Note: This version will not work with Trac 0.10!
For Trac 0.10
The TracRedirect macro has been converted into a plugin. Thanks to Michel Jouvin for doing the initial conversion!
The installation is very easy: Simply drop this Python egg into the plugin subdir of your project. Note: This requires Trac >= 0.9 and setuptools >= 0.6! The pre-packaged egg is for Python 2.4.
The source code is available, so you can build your own egg:
- as a ZIP archive: Redirect-0.9.1.zip
- browsable: [source:/trac/plugins/redirect]
- via anonymous SVN
To enable the plugin, add this setting to your trac.ini file:
[components] redirect.* = enabled
For more information about Trac plugins, see http://projects.edgewall.com/trac/wiki/TracPlugins.
For Trac 0.9
Download the redirect.py macro [source:trac/trunk/wiki-macros/redirect.py here] and put it either in the global wiki-macros directory of your Trac installation (typically /usr/share/trac/wiki-macros) or into the wiki-macros subdirectory of your project.
Then add these lines to the templates/site_header.cs file within your project:
<?cs if:args.redirectedfrom ?> <?cs set:chrome.nav.metanav.redirectedfrom = 'Redirected from <a href="' + trac.href.wiki + '/' + args.redirectedfrom + '?redirect=no">' + args.redirectedfrom + '</a>' + ' (<a href="' + base_url + HTTP.PathInfo + '">hide</a>)' ?> <?cs /if ?>
For Trac 0.8
You can download the latest version for Trac 0.8.x [source:trac/trunk/wiki-macros/redirect.py@3026 here]. Put the redirect.py file in the global wiki-macros directory of your Trac installation (typically /usr/share/trac/wiki-macros).
Additionally, you need the following two patches in order to display a link on the target page of the redirection back to the alias page (e.g for editing the alias). When following the backlink, redirection is disabled.
-
templates/wiki.cs
5 5 <div id="ctxtnav" class="nav"> 6 6 <h2>Wiki Navigation</h2> 7 7 <ul> 8 <?cs if args.redirectedfrom ?> 9 <li class="redirect"> 10 Redirected from: 11 <a href="<?cs var:$trac.href.wiki ?>/<?cs var:args.redirectedfrom ?>?redirect=no"> 12 <?cs var:args.redirectedfrom ?></a> 13 (<a href="<?cs var:args.page ?>">hide</a>) 14 </li> 15 <?cs /if ?> 16 8 17 <li><a href="<?cs var:$trac.href.wiki ?>">Start Page</a></li> 9 18 <li><a href="<?cs var:$trac.href.wiki ?>/TitleIndex">Title Index</a></li> 10 19 <li><a href="<?cs var:$trac.href.wiki ?>/RecentChanges">Recent Changes</a></li>
-
htdocs/css/wiki.css
50 50 .wiki-toc.trac-nav .edit a { color:blue; border-color:blue; } 51 51 52 /* Styles for Redirect */ 53 .redirect { 54 margin-bottom: 1em; 55 color: #cccccc; 56 } 57 .redirect :link, .redirect :visited { 58 color: #bb5555; 59 }
Feedback
Please send questions, bug-reports, suggestions, etc. per e-mail to either haui at haumacher dot de, or to thomas.moschny at gmx dot de.
Attachments (5)
- new.png (306 bytes) - added by moschny 17 years ago.
- Redirect-0.9.1-py2.4.egg (7.7 KB) - added by moschny 17 years ago.
- Redirect-0.9.1.zip (11.9 KB) - added by moschny 17 years ago.
- TracRedirect-0.11.2-py2.5.egg (8.3 KB) - added by moschny 15 years ago.
- TracRedirect-0.11.2.zip (12.6 KB) - added by moschny 15 years ago.
Download all attachments as: .zip