plonediazo

How to deliver static html with plone.app.theming


I use Diazo to deploy the static html-file 'ticker.html' on a certain url. That page uses nothing at all from the content.

This is the rules.xml:

<rules xmlns="http://namespaces.plone.org/diazo"
       xmlns:css="http://namespaces.plone.org/diazo/css"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <rules if-path="/Plone/ticker/ /ticker/">
    <theme href="ticker.html" />
  </rules>

  <rules css:if-content="#visual-portal-wrapper" if-not-path="/Plone/ticker/ /ticker/">
    <theme href="index.html" />    
    The rest of the theme...
  </rules>
</rules>

It works fine and the html is correct but the return-code of http://localhost:8080/Plone/ticker is 404. Only if I create some dummy content in Plone at this location I get a 200. The returned is also slightly changed: When there is a dummy content Diazo adds a base-tag to the header:

<base href="http://localhost:8080/Plone/ticker/" />

How can I tell Diazo to completely ignore the content and return a 200 even when there is no dummy-content?

In case you are wondering: I use Diazo for this because plone.app.themeing allows to modify the static page through the web.


Solution

  • The plone.app.theming transformation is the last step in the delivery pipeline. The content has already been summoned from Plone so that it can be combined with the theme. So, it's not the appropriate place to do this.

    Instead, do this with the rewrite rules of your reverse proxy. Have the proxy fetch your ticker whenever it receives a request for the target URL. You'll also save a lot of CPU cycles in the process, since you'll avoid the whole trip through Zope/Plone's machinery.