shared templates and htdocs

25 views
Skip to first unread message

Clemens Feige

unread,
Nov 7, 2018, 5:35:10 AM11/7/18
to trac-...@googlegroups.com
Hello

I like to ask for help concerning placement of shared templates and
htdocs. How can I share one common <site.html> and one common
<style.css> file across multiple TRAC repositories?

I have read the docu (TracIni, TracInterfaceCustomization and others)
but cannot get it working. My current workaround is to copy the
<site.html> <style.css> many times into each repo.

I am using TRAC 1.2.2 on Linux.

This is my desired directory structure:
/data/trac/trac.global.ini
/data/trac/htdocs/style.cs
/data/trac/templates/site.html
/data/trac/plugins/<plugin eggs are here>
... then a bunch of repos:
/data/trac/repos/myrepo1/
/data/trac/repos/myrepo2/

This is how I import the CSS file from the <site.html>
<link rel="stylesheet" href="${href.chrome('site/style.css')}" />

This is what I put in the trac.ini of each repo:
[inherit]
file = /data/trac/trac.global.ini
plugins_dir = /data/trac/plugins
htdocs_dir = /data/trac/htdocs

Please advice.

Thanks
Clemens

RjOllos

unread,
Nov 14, 2018, 3:53:40 PM11/14/18
to Trac Users
You probably need to set [inherit] templates_dir:

Do you find style.css when you navigate to?:
/chrome/shared/style.css

It looks like you need to substitute "shared/style.css" for "site/style.css" in your template.

- Ryan

Clemens Feige

unread,
Nov 15, 2018, 6:01:19 AM11/15/18
to trac-...@googlegroups.com
Thanks Ryan.

Your hints were very helpful and solved my issue.

I did as you said:
I added "[inherit] templates_dir" to the trac.ini of each repo:

[inherit]
file = /data/trac/trac.global.ini
plugins_dir = /data/trac/plugins
templates_dir = /data/trac/templates
htdocs_dir = /data/trac/htdocs

... and in site.html changed to:
<link rel="stylesheet" href="${href.chrome('shared/style.css')}" />

The CSS is now found at URL /chrome/shared/style.css

Thanks again
Clemens

RjOllos

unread,
Jul 5, 2019, 11:41:05 PM7/5/19
to Trac Users
Edited page to make a section for information on Sharing Templates:

- Ryan
Reply all
Reply to author
Forward
0 new messages