In a website's editor, Code shows the whole website as one file: the layout every page shares, then each page. The preview beside the file shows the page open in the editor and changes as you type.

How the file is laid out

The file starts with a comment that explains it. Then comes the layout: the head, the styles, the header, the footer and any scripts. {% content %} marks where each page's own sections go.

Then each page, in the order of the website's pages:

{% page path="/about" title="About" menu=true id="…" %}
<section class="site-section site-copy">
    <h1>About us</h1>
    <p>We bake every morning from four.</p>
</section>
{% endpage %}
  • path is the page's address. / is the home page, and only the home page.
  • title is the page's name.
  • menu=true lists the page in the website's navigation, and menu=false leaves it out.
  • id is how Magpie knows the page. Keep it as it is.

A page written without an id is a new page. Comments between {# and #} are for people: Magpie writes some, and none is saved.

The Shop, Blog and Portfolio pages each have a section Magpie fills: the products (data-magpie-shop-products), the posts (data-magpie-blog-posts) or the projects (data-magpie-projects). Magpie puts one back if it goes missing. An element marked data-magpie-nav gets a link to each page the navigation lists.

Saving

The layout and the pages' sections save as drafts a moment after you stop typing, as they do in Visual mode. Visitors see them once you publish.

A page's name, its address, whether the navigation lists it, the order of the pages and new pages change on the published website at once, as they do in Pages. So they wait: the line under the file lists them under Not saved yet, and Save page changes saves them. Ctrl+S (Cmd+S on a Mac) does the same. A page that moves keeps its old address working, sending visitors on to the new one.

To delete a page, use Pages. A file that leaves a page out saves its other changes, but not the changes to the pages, until you put the page back or delete it.

When the file is refused

When Magpie cannot read the file, nothing in it is saved, and the line under the file says what is wrong and on which line. Choose the line number to go there. For example, a page with no {% endpage %} before the next page, or a layout without {% content %}.

Changing it with an AI chat

In More › Import JSON…, Change what I have copies a prompt that ends with this file as it is in Code mode. Paste the prompt into an AI chat and say what you want. Paste its whole answer into the same box: the button reads Replace the website. The file opens in Code mode, with Undo in the message. Its sections save as drafts, and Save page changes applies what it says about the pages.

Start fresh copies the prompt for a new page as JSON instead; see Build a website by pasting JSON.

If Magpie refuses the file and its message does not say why, Contact support.

Ask Magpie support

Send Magpie staff a question about anything this article does not answer.