News Learn Download
Overview News Manual

Templating Basics

When a URL path does not lead directory to a file, sprouts looks instead for a template file.

Files ending in .scgo are interpreted as Scriggo templates.

Files ending in .tmpl or .pgo2 are interpreted as Pongo2 templates.

If you have a template file under blog/first_essay.scgo in your site directory, it can be accessed from the browser via url /blog/first_essay, with the template extension removed.

If a file starts with an underscore, such as _base.scgo then it will not be accessible via a public URL, but other templates can include it or extend it.

Templating Languages

Scriggo is more powerful, feature complete, and well documented, and we strongly recommend it over Pongo2, which is going to be deprecated and probably removed in the near future.

That said, both templating languages allow you to:

In addition, Scriggo features:

Scriggo's documentation is available here: https://scriggo.com/templates

Pongo2 has no documentation that I'm aware of, so I wrote up a quick tutorial here:

Markup languages

You can use Markdown and D2.

Markdown is a markup language used to created formatted text without html tags.

D2 is a text-to-diagram markup language used to created various kinds of diagrams.

Scriggo

When using Scriggo, markdown blocks can be written this way:

{% show markdown(itea); using markdown %}
# Markdown Content

Goes here! You can do anything!
{% end %}

D2 blocks can be written like this:

{% show d2(itea); using %}
    A -> B
{% end %}

Pongo2

For Pongo2, markdown and d2 are defined as filters

Markdown:

{% filter markdown %}
# Markdown Content

Goes here! You can do anything!
{% endfilter %}

D2:

{% filter d2 %}
A -> B
{% endfilter %}

Markup block de-indentation

In both Scriggo and Pongo2 templates, you can indent the markup text, and it will be de-indented before processing.

    <div id="content">
        {% show markdown(itea); using markdown %}
            # Markdown Content

            Goes here! You can do anything!

            This is not a code block! Just regular text!

                This is an additional indentation and will
                be interpreted as a code block!

            Now this is paragraph text
        {% end %}
    </div>

Make base layout files private

In both Scriggo and Pongo, creating a shared layout involves first creating a "base" template file that you then extend.

{% extends "_base.scgo" %}

If the base file does not start with an underscore, it will be accessible via a regular URL, which in most cases is something you don't want.


Next: Pongo2 Tutorial