Edgewall Software

Changes between Version 82 and Version 83 of TracInterfaceCustomization


Ignore:
Timestamp:
Apr 15, 2015, 1:35:22 PM (5 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • TracInterfaceCustomization

    v82 v83  
    1 = Customizing the Trac Interface =
     1= Customizing the Trac Interface
     2
    23[[TracGuideToc]]
    34[[PageOutline]]
    45
    5 == Introduction ==
     6== Introduction
     7
    68This page gives suggestions on how to customize the look of Trac. Topics include editing the HTML templates and CSS files, but not the program code itself. The topics show users how they can modify the look of Trac to meet their specific needs. Suggestions for changes to Trac's interface applicable to all users should be filed as tickets, not listed on this page.
    79
    8 == Project Logo and Icon ==
     10== Project Logo and Icon
     11
    912The easiest parts of the Trac interface to customize are the logo and the site icon. Both of these can be configured with settings in [wiki:TracIni trac.ini].
    1013
    1114The logo or icon image should be put in a folder named "htdocs" in your project's environment folder. ''Note: in projects created with a Trac version prior to 0.9 you will need to create this folder''.
    1215
    13  ''Note: you can actually put the logo and icon anywhere on your server (as long as it's accessible through the web server), and use their absolute or server-relative URLs in the configuration.''
     16 '''Note''': you can actually put the logo and icon anywhere on your server (as long as it's accessible through the web server), and use their absolute or server-relative URLs in the configuration.
    1417
    1518Now configure the appropriate section of your [wiki:TracIni trac.ini]:
    1619
    17 === Logo ===
     20=== Logo
     21
    1822Change 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's dimensions. The Trac chrome handler uses "`site/`" for files within the project directory `htdocs`, and "`common/`" for the common `htdocs` directory belonging to a Trac installation. Note that 'site/' is not a placeholder for your project name, it is the literal prefix that should be used. For example, if your project is named 'sandbox', and the image file is 'red_logo.gif' then the 'src' setting would be 'site/red_logo.gif', not 'sandbox/red_logo.gif'.
    1923
    20 {{{
     24{{{#!ini
    2125[header_logo]
    2226src = site/my_logo.gif
     
    2630}}}
    2731
    28 === Icon ===
     32=== Icon
     33
    2934Icons are small images displayed by your web browser next to the site's URL and in the `Bookmarks` menu. Icons should be a 32x32 image in `.gif` or `.ico` format. Change the `icon` setting to `site/` followed by the name of your icon file:
    3035
    31 {{{
     36{{{#!ini
    3237[project]
    3338icon = site/my_icon.ico
     
    3641Note 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 IE as well as other browsers, you can store the icon in the document root of the host and then reference it from `trac.ini` as follows:
    3742
    38 {{{
     43{{{#!ini
    3944[project]
    4045icon = /favicon.ico
     
    4348If your browser does not show your favicon in the address bar, append a "?" to the file extension:
    4449
    45 {{{
     50{{{#!ini
    4651[project]
    4752icon = /favicon.ico?
    4853}}}
    4954
    50 == Custom Navigation Entries ==
     55== Custom Navigation Entries
     56
    5157The new [mainnav] and [metanav] can now be used to customize the text and link used for the navigation items, or even to disable them, but not for adding new ones.
    5258
    5359In the following example, we rename the link to the Wiki start "Home", and hide the "!Help/Guide". We also make the "View Tickets" entry link to a specific report:
    54 {{{
     60{{{#!ini
    5561[mainnav]
    5662wiki.label = Home
     
    6571== Site Appearance == #SiteAppearance
    6672
    67 Trac is using [http://genshi.edgewall.org Genshi] as the templating engine. Say you want to add a link to a custom stylesheet, and then your own header and footer. Save the following content as `site.html` inside your projects `templates/` directory (each Trac project can have their own `site.html`), eg {{{/path/to/env/templates/site.html}}}:
     73Trac is using [http://genshi.edgewall.org Genshi] as the templating engine. Say you want to add a link to a custom stylesheet, and then your own header and footer. Save the following content as `site.html` inside your projects `templates/` directory (each Trac project can have their own `site.html`), eg `/path/to/env/templates/site.html`:
    6874
    6975{{{
     
    200206   }}}
    201207
    202 == Project Templates ==
     208== Project Templates
    203209
    204210The appearance of each individual Trac environment, ie instance of a project, can be customized independently of other projects, even those hosted on the same server. The recommended way is to use a `site.html` template (see [#SiteAppearance]) whenever possible. Using `site.html` means changes are made to the original templates as they are rendered, and you should not normally need to redo modifications whenever Trac is upgraded. If you do make a copy of `theme.html` or any other Trac template, you need to migrate your modifiations to the newer version. If not, new Trac features or bug fixes may not work as expected.
     
    212218Trac resolves requests for a template by first looking inside the project, then in any inherited templates location, and finally inside the Trac egg.
    213219
    214 Trac caches templates in memory by default to improve performance. To apply a template you need to restart the server.
     220Trac caches templates in memory by default to improve performance. To apply a template you need to restart the web server.
    215221
    216222----