Guide 00 · Developer docs

Core dna for site builders

Read this guide first. Core dna is hosted, so there is nothing to install; your repository holds only templates and front-end assets; and a new kind of page starts in the admin, with a layout. In half a day, from what the platform is to a page you built, deployed and rendered in Smarty or Twig.

L0
Unit 03 · Your first page, end to end

Start with a placeholder template

The first page of a site, built in the order the platform needs, and its first step: a placeholder template at the path the layout will name, committed and deployed. Then what a wrong template path looks like in each engine.

Who this is for. A theme developer making a site's first page type, on the development environment, before building anything real. By the end of this unit you will have created an Article layout with three areas, a page that uses it, and a template that renders it, in the order every later page type will follow.

The whole path

  1. Deploy a placeholder template at the path the layout will use: this page.
  2. Create the layout in the admin, pointing at that file.
  3. Add the areas, the fields editors will fill in.
  4. Create and publish a page that uses the layout.
  5. Render the areas in the real template.

The file comes first for a practical reason: the admin can point a layout only at a template that is already on the server. The design of the page type still starts with the layout, its areas and their names, as Development starts with a layout explains; the placeholder only gives the layout something to point at. Keep Nothing changed: the four checks open for when a step does not show up.

Create the placeholder

Page templates conventionally live under templates/pages/pages/. Create templates/pages/pages/article.html with enough markup to recognise it, extending the site's own base template. The base template's path and its block name vary from site to site; use the ones your site's other page templates use.

Template code templates/pages/pages/article.html
{extends 'includes/frontend/base-template.html'}
{block 'content'}
  <main>
    <h1>{$page->getName()|escape}</h1>
    <p>Article layout works.</p>
  </main>
{/block}
{% extends 'includes/frontend/base-template.html' %}
{% block content %}
  <main>
    <h1>{{ page.getName()|e }}</h1>
    <p>Article layout works.</p>
  </main>
{% endblock %}

Commit and deploy it

Commit the template, and push the branch the development environment follows (Deploying a change). The file will not answer at any URL, because templates are never served; the check that it arrived is the next step, where it appears in the layout form's list of templates.

Go deeper

Was this page helpful?

Your answer goes to the docs team.