tracinterfacecustomization
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | tracinterfacecustomization [2015/06/09 15:23] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Customizing the Trac Interface ====== | ||
+ | [[: | ||
+ | |||
+ | ===== Introduction ===== | ||
+ | This page is meant to give users suggestions on how they can customize the look of Trac. Topics on this page cover editing the HTML templates and CSS files, but not the program code itself. | ||
+ | |||
+ | ===== Project Logo and Icon ===== | ||
+ | The easiest parts of the Trac interface to customize are the logo and the site icon. Both of these can be configured with settings in [[: | ||
+ | |||
+ | The logo or icon image should be put in a folder named " | ||
+ | |||
+ | '' | ||
+ | |||
+ | Now configure the appropriate section of your [[: | ||
+ | |||
+ | ==== Logo ==== | ||
+ | Change the `src` setting to `site/` followed by the name of your image file. The `width` and `height` settings should be modified to match your image' | ||
+ | |||
+ | < | ||
+ | [[: | ||
+ | src = site/ | ||
+ | alt = My Project | ||
+ | width = 300 | ||
+ | height = 100 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Icon ==== | ||
+ | Icons should be a 16x16 image in `.gif` or `.ico` format. | ||
+ | |||
+ | < | ||
+ | [[: | ||
+ | icon = site/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Note though that this icon is ignored by Internet Explorer, which only accepts a file named ``favicon.ico`` at the root of the host. To make the project icon work in both IE and other browsers, you can store the icon in the document root of the host, and reference it from ``trac.ini`` as follows: | ||
+ | |||
+ | < | ||
+ | [[: | ||
+ | icon = / | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Site Header & Footer ===== | ||
+ | |||
+ | In the environment folder for each Trac project there should be a directory called // | ||
+ | |||
+ | These files may contain static HTML, though if users desire to have dynamically generated content they can make use of the [[http:// | ||
+ | |||
+ | ===== Site CSS ===== | ||
+ | The primary means to adjust the layout of a Trac site is to add [[http:// | ||
+ | |||
+ | While you can add your custom style rules directly to the `site_css.cs` file, it is recommended that you simply reference an external style sheet, thereby enabling browsers to cache the CSS file instead of transmitting the rules with every response. | ||
+ | |||
+ | The following example would import a style sheet located in the `style` root directory of your host: | ||
+ | < | ||
+ | @import url(/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | You can use a ClearSilver variable to reference a style sheet stored in the project environment' | ||
+ | < | ||
+ | @import url(<?cs var: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Project List ===== | ||
+ | You can use a custom ClearSilver template to display the list of projects if you are using Trac with multiple projects. | ||
+ | |||
+ | The following is the basic template used by Trac to display a list of links to the projects. | ||
+ | |||
+ | < | ||
+ | #!text/html | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | if: | ||
+ | <a href="<? | ||
+ | <?cs var: | ||
+ | else ?> | ||
+ | < | ||
+ | | ||
+ | /if ?> | ||
+ | </ | ||
+ | /each ?> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Once you've created your custom template you will need to configure the webserver to tell Trac where the template is located: | ||
+ | |||
+ | For [[: | ||
+ | < | ||
+ | FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/ | ||
+ | -initial-env TRAC_ENV_INDEX_TEMPLATE=/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | For [[: | ||
+ | < | ||
+ | PythonOption TracEnvIndexTemplate / | ||
+ | </ | ||
+ | |||
+ | |||
+ | For [[: | ||
+ | < | ||
+ | SetEnv TRAC_ENV_INDEX_TEMPLATE / | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Main Templates ===== | ||
+ | |||
+ | It is also possible to use your own modified versions of the Trac [[http:// | ||
+ | |||
+ | If you absolutely need to use modified templates, copy the template files from the default templates directory (usually in found in `$prefix/ | ||
+ | |||
+ | ---- | ||
+ | See also TracGuide, TracIni | ||
+ | |||
tracinterfacecustomization.txt · Last modified: 2015/06/09 15:23 by 127.0.0.1