Skip to main content

Working with Server Side Includes

You can publish snippets of HTML and pull them in via Server Side Includes (SSI) at runtime on your live web server. This is useful for navigation menus, footers, and anything else used across your site.

One drawback of a push CMS like Cascade CMS is that changing a navigation menu means a full site publish to update every page. With SSI, you publish a single asset and every page picks up the change almost immediately.

Set up a page type for "include" files

  1. Create a new Template with this content:

    HTML
    <!--#cascade-skip-->
    <pass-through>
      <system-region name="DEFAULT"/>
    </pass-through>
  2. Create a new Configuration with these settings:
    • Check Default Output
    • Type of Data — HTML
    • File Extension — .shtml
    • Template — the Template from the first step
    • Check Publishable
  3. Create a new Content Type with these settings:
    • Configuration — the Configuration you just created
    • Metadata Set — the Default is usually fine
    • Type of Content — No Data Definition (WYSIWYG Only)

Create the "include" page

  1. From Add Content, create a new XML Block with this content:

    HTML
    <!--#protect-top
    <ul>
      <li>Sample item 1</li>
      <li>Sample item 2</li>
      <li>Sample item 3</li>
    </ul>
    #protect-top-->
  2. From Add Content, create a new Default → Page, selecting the Content Type you created above.
  3. Name the page include-file, then click the Configure tab.
  4. In the Regions section, use the Block chooser on the DEFAULT region to select the XML Block above.
  5. Submit the page.
  6. Publish it to your web server and verify with More → Live. You should see a mostly empty page containing just the unordered list.

Add the SSI directive to your pages

  1. From Add Content, create another XML Block with this content:

    HTML
    
    
    
    <!--#include virtual="" -->
    
  2. Create or edit a page, click the Configure tab, and in Regions attach this XML Block to the region where the snippet should appear.

The system-view tags control what shows inside the CMS versus what shows once published — necessary because SSIs only work on the live website. The system-asset tags around the include path tell the system this is a managed asset whose link should be rewritten on publish.