How to configure default website theme?

I have a 'Site' that I created in my Nuxeo instance that is going to be our default landing page for our users. However, I want to theme it to use our color scheme. Where can I edit the css for the default 'Site' template? In the source of the site apge, it looks like it is loading sites-styles.css into the screen.css for that page, but for the life of me I can't find it anywhere.

0 votes

1 answers

1974 views

ANSWER



The theme definition for the web site is a bit… complex and we plan to rewrite it as soon as possible as we rewritten the theme edition for the JSF part. Any way, I will give you keys to do what you want. For the all web site theme definition look the /nuxeo-webengine-sites/src/main/resources/OSGI-INF/theme-contrib.xml file.

The definition of the theme is described by this extension point:

  <extension target="org.nuxeo.theme.services.ThemeService"
    point="themes">
    <theme>
      <src>
        themes/theme-sites-setup.xml
      </src>
    </theme>
  </extension>

If you look into this xml file you see how the page is structured (header, footer) and you have in it some css instructions.

The way to do what you want will be:

  • you copy the xml into your bundle
  • modify the css part (don't change the page structure if this good for you)
  • be careful in this xml file to let the name as “sites” to override the default one
  • in your component add the require “org.nuxeo.webengine.sites.theme”

In fact to give you an overview of the structure of our old theme management is like this:

  • in org.nuxeo.theme.services.ThemeService/themes you contribute the xml file that will describe pages structure in the layout part. Each Page item will describes a new page structure
  • Widget part affects elements to a fragment defined into the layout part. page[2]/section[2]/cell[2]/fragment[2] define the theme widget that will be affected to the second fragment of the second cellule of the second section of the second page of the layout. In the “sites” theme we affect the widget called “Page Create” (see below the definition of this theme widget).
  • This is the same for the css, we affect the css for each part of the page.
  • Then the theme widget definition are define into the org.nuxeo.theme.services.ThemeService/views. So the “Page Create” is define by the “widgets/webpage_create.ftl” freemarker template.
  • Finally about theme affectation to the website object is defined by a negotiator defined by this extension point org.nuxeo.theme.services.ThemeService/applications, you will see that we affect the sites/default is affected to ${org.nuxeo.ecm.contextPath}/sites (so websites). sites/default means the layout sites (defined into theme-sites-setup.xml) and the default page.

We have also a notion of a perspective, but I don't want to go mad. I let it digest :)

0 votes