wiki:AddHeadersPlugin

Version 1 (modified by Martin Scharrer, 11 years ago) (diff)

New hack AddHeadersPlugin, created by martin_s

Add HTML Headers to Trac Pages in a simple way

Description

This plug-in allows Trac 0.11 server admins to add script and link headers into all trac pages without having to create a Chrome template file.

Installation

Copy the single python file into the 'plugins' directory of your trac installation and add the following into the config file (normally 'conf/trac.ini'):

[components]
addheaders.* = enabled

Bugs/Feature Requests

Existing bugs and feature requests for AddHeadersPlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from [download:addheadersplugin here].

Source

You can check out AddHeadersPlugin from here using Subversion, or browse the source with Trac.

Example

The following example shows how to add files for a multi-style implementation:
The JavaScript file is located "$TRAC_PROJECT_DIR/htdocs/js/multistyle.js" and all CSS files are located at "$TRAC_PROJECT_DIR/htdocs/css/". A general style file 'common.css' is included which holds all common style definition. The default style is in 'default.css' and the alternative styles in 'theme1.css' and 'theme2.css'.

# in trac.ini
[addheaders]
default_style_base  = site/css/
default_script_base = site/js/

add_scripts  = multistyle
add_styles   = common
add_links    = style0,style1,style2

style0.rel   = stylesheet
style0.type  = text/css
style0.title = default
style0.href  = /chrome/site/default.css

style1.rel   = alternate stylesheet
style1.type  = text/css
style1.title = theme1
style1.href  = /chrome/site/theme1.css

style2.rel   = alternate stylesheet
style2.type  = text/css
style2.title = theme2
style2.href  = /chrome/site/theme2.css

Recent Changes

17136 by rjollos on 2018-04-16 19:54:35
TracAddHeadersPlugin 0.4: Conform to PEP8
15264 by rjollos on 2016-02-11 04:22:34
Remove unnecessary svn:mime-type on py files

svn:mime-type was set to "plain" for many files.

9844 by martin_s on 2011-02-08 17:33:08
tracaddheaders/plugin.py
Made meta name attribute default to the name used in the config file.
(more)

Author/Contributors

Author: martin_s
Contributors: