[Mailman-Users] Editing the archives HTML pages

Richard Barrett R.Barrett at ftel.co.uk
Wed Aug 21 17:06:44 CEST 2002


At 13:32 21/08/2002 +0200, Webmaster ST Frontier Fleet wrote:

> > Hello,
> >
> > How can I edit the HTML of the archives pages?
> >
> > Thanks for any help,
> >
> > Anclo
> >
>Hi Anclo,
>
>I've been looking for an answer to that question for a while, but the
>only solution I could find was switching from the internal pipermail
>archive to an external archive like MhonArc.
>
>However, as that solution was not my favorite one, seeing I could not
>figure out if and how this could done on a per list setting (only for
>all lists mailman was running, which was not what I wanted), I ended up
>writing a special PHP script that dynamically loaded the original
>mailman archives and added a CSS stylesheet file, which adds another
>look to the page. However, this script is completely customized for our
>own usage... although I suppose changes could be made to make it a more
>general script...
>
>In each case, AFAIK the easiest way is setting up an external archiver.
>
>I hope this answers your question sufficiently.... and if somebody knows
>a better answer... feel free to correct me.
>
>Kind regards,
>
>Guido

With MM 2.1 the HTML template for the archived mail pages is in 
$prefix/template/<language>/article.html, where language is one of the 
number of languages supported by MM 2.1

You should be able to (carefully) edit this file to suit your needs.

If you absolutely have to use 2/0.x, then you'll have to change the string 
variable called article_template in $prefix/Mailman/Archiver/HyperArch.py.

In all cases, your changes will affect all new archive article pages on 
your MM site.

Do not blame me if you get you editing wrong and your system bursts into 
flames!

Per Guido's response saying he wanted to achieve a per list look-and-feel 
this is entirely doable without resorting to PHP.

The archived mail pages generated from these templates always resides one 
directory level down from the list's archive directory 
$prefix/archives/private/<listname>.

You could put per list look and feel CSS and like the in that directory and 
refer to it in your modified HTML article template using relative URLs.

With some judicious use of CSS and Javascript I guess you could achieve 
quite a lot.

One problem is that after creating each new list you will must add your 
extras to its private archive directory. This is an all or nothing approach.

In general, this scheme would work best if all your lists had public archives.

The problem of relative addressing with a private archive is the requests 
for your list specific furniture are going end up being requested with URL 
paths of the form /mailman/private/<listname>/<your-special-stuffs-name>. 
This means they will be served by the $prefix/Mailman/Cgi/private.py 
script. This script will do this OK but is a bit simple minded in figuring 
out the MIME type it returns in the Content-type: response header. The 
extra files you may want to have served, Javascript or CSS files for 
instance, will not have their mime types correctly reported.. You could 
substitute the following for the definition of the content_type function in 
$prefix/Mailman/Cgi/private.py to resolve this potential problem:

import mimetypes

def content_type(path):
     mtype = mimetypes.guess_type(path)[0]
     if not type:
         mtype = 'application/octet-stream'
     return mtype

Use this 'advice' at your own risk!





More information about the Mailman-Users mailing list