User Guide

Tagging Your Site for Feature Rules

21 views 0

When using Zephr Feature Rules – rules that target a specific feature or piece of content on a page – you will need to add Zephr Feature Tags. These tags tell Zephr what feature your rule corresponds to, and can be found in the Site Integration Tip section of a Zephr Feature Rule.

Site features are parts of an HTML document (like an article body, a video, a data table, etc.) which are annotated with HTML comments.

Consider the following HTML:

<html>
<head>…
</head>
<body>
    <h1>A site!</h1>
    <nav>…
    </nav>
    <div class="page-wrapper">
       <h2>Something interesting</h2>
       <article class="article-body">
          <p>…</p>
          <img>
          <p>…</p>
       </article>
       <ul class="related-reading">…
       </ul>
    </div>
</body>

In this case, one might want to make decisions about whether a visitor can assess the article body. To do that, you would wrap the following comments around the article. Usually, these comments would be implemented in a CMS template, but can also be done on a per article basis.

<head>…
</head>
<body>
    <h1>A site!</h1>
    <nav>…
    </nav>
    <div class="page-wrapper">
       <h2>Something interesting</h2>
       <!-- BLAIZE_FEATURE article-body -->
       <article class="article-body">
          <p>…</p>
          <img>
          <p>…</p>
       </article>
       <!-- BLAIZE_FEATURE_END article-body -->
       <ul class="related-reading">…
       </ul>
    </div>
</body>

If this document were to be served through the Zephr CDN, the Zephr Feature comment would be picked up and Zephr would look for a corresponding feature rule to decide how to handle that part of the content.

Zephr Feature comments are used under the hood to break a document into a tree, which Zephr will traverse in real-time to manipulate the content. Zephr Feature comments can be nested and repeated but do need to be balanced, in terms of their opening and closing, much like HTML tags.