gs.content.email.layout

HTML-formatted email notifications are formatted differently to Web pages, due to the peculiarities of email clients. This product supplies the page template that provide the layout for the HTML notifications. The resulting page is then normally processed by the gs.content.email.base.SiteEmail or gs.content.email.base.GroupEmail classes [1] to produce an HTML page that can be added to a notification [2].

Contents:

Page Template

The groupserver_email_layout/page page template provides a simple full-page layout for an email notification:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      metal:use-macro="context/@@groupserver_email_layout/page">

There are three slots defined by the macro.

metal:fill-slot="title":
The compulsory title of the page. It is always provided by pages that use the standard layouts, and always contains a <title> element. It is normally set to the subject of the email message:
<title metal:fill-slot="title">This is the title</title>
metal:fill-slot="preheader":
Some email clients show a short snippet of text from the email message just below the Subject as a preview. For a normal notification this will usually be the site-name and the header from the body. While ok, notifications can add a preheader that will be hidden in the HTML, but will appear as a preview.
<span metal:fill-slot="preheader">This appears below the Subject</span>
metal:fill-slot="prebody":
The optional content that appears before the header of the page. Used by some pages to emulate the look of an email message by adding false To, From and Subject fields.
metal:fill-slot="body":
The compulsory body of the page.

Example

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      metal:use-macro="context/@@groupserver_email_layout/page">
  <head>
    <title metal:fill-slot="title">Notification:
      <span tal:replace="view/siteInfo/name">Site</span></title>
  </head>
  <body>
    <div id="a-page" metal:fill-slot="body">
      <p>I am a notification, honest.</p>
    </div><!--a-page-->
  </body>
</html>

Viewlets

The email layout uses two viewlet managers. The groupserver.emailStyle manager supplies the CSS that lays out the message [1]. The footer is supplied by the groupserver.emailFooter, which is provided by this product.

Within the footer there is one viewlet by default: gs-content-email-layout-footer. It links to the Privacy policy, Acceptable use policy, and the About page for the site. The links to these pages gives some semblance of propriety to the email notification.

[1]See <https://github.com/groupserver/gs.content.email.css/>

Changelog

2.3.4 (2015-09-16)

2.3.3 (2015-09-03)

  • Subtle adjustments to the width, for small-screen devices

2.3.2 (2015-07-24)

  • Removing an extra bullet (•) from the footer

2.3.1 (2015-06-02)

  • Improving the layout

2.3.0 (2015-05-12)

  • Adding the preheader slot

2.2.0 (2015-04-23)

  • Fixing the site-URL
  • Switching to a table-based layout

2.1.3 (2015-04-02)

2.1.2 (2014-10-10)

  • Pointing the product metadata at the new GitHub repository
  • Naming the reStructuredText files as such

2.1.1 (2014-06-24)

  • Updating the version.py

2.1.0 (2013-10-31)

  • Adding an CSS <style> block that is ignored by Premailer.

2.0.1 (2013-10-08)

  • Fixing the product metadata

2.0.0 (2013-09-27)

  • Initial (released) version