[ckan-dev] How to add custom CSS file

Philipp Lämmel philipp.laemmel at fokus.fraunhofer.de
Tue Sep 20 13:27:39 UTC 2011


Hey folks,

I'm currently working on the Berlin OpenData portal and have a question 
on how to add my own CSS file.

We wrote our own extension, which adds a new public path to the config file:

     rootdir = os.path.dirname(os.path.dirname(here))
     our_public_dir = os.path.join(rootdir, 'ckanext', 'berlin', 
'theme', 'public')
     config['extra_public_paths'] = ','.join([our_public_dir, 
config.get('extra_public_paths', '')])

This directory contains our file 'extra.css', which changes the 
background color . According to your documentation, I should edit 
layout.html:

<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:i18n="http://genshi.edgewall.org/i18n"
       xmlns:py="http://genshi.edgewall.org/"
       xmlns:xi="http://www.w3.org/2001/XInclude"
       py:strip="">
<py:def function="optional_head">
<link rel="stylesheet" href="${g.site_url}/css/extra.css" />
</py:def>
<xi:include href="layout_base.html" />
</html>


But every time I add my own CSS-file, some features stop working (e.g. 
tagcompletion or the name suggestion according to the title).

Do I miss any basic steps in adding my own CSS-file? Could you please 
provide a small how to? Is there any other way with which I could change 
the layout ?

Regards,

Phil




More information about the ckan-dev mailing list