Build a website from a Git repository
Make a files website's files come from a Git repository, so each push publishes them, as they are or built from Markdown and templates.
A files website's files can come from a Git repository in the team instead of uploads. Each push to the repository's branch makes the website again from the files at that commit, and Build now on the website's page makes it from the branch as it is. Everything else about a files website is the same as in Host a website from your own files: its address, its versions, its domain.
To use a repository, make a files website, then choose More, Switch where files come from, and A Git repository, and pick the repository and branch. Until the first push or Build now, the website keeps the files it has. Switching back to Uploads on this page keeps the live version and stops pushes changing the website. Only a member who can push to the repository can change the website's files, which the Files band says. Pushing needs a token or an SSH key; see Clone and push with a token or SSH key.
Files as they are
A repository without a content/ folder is copied as it is: every file except
the .git/ folder, files and folders whose names start with a dot, and files a
website refuses (programs and server-side code) becomes part of the version,
with index.html at the top as the home page. The version's log names anything
left out.
Files built from Markdown
A repository with a content/ folder is built:
| Path | Use |
|---|---|
site.yml |
title, description and language for the whole site. |
content/ |
One page per Markdown (.md) or HTML file. content/about.md is published at /about/; content/index.md is the home page. |
layouts/ |
Templates. layouts/default.html is used when a page names no other. |
static/ |
Copied to the site root as it is, for example static/css/site.css becomes /css/site.css. |
Other files inside content/, such as images, are copied to the same path without content/, so content/images/logo.png is served at /images/logo.png.
Pages
A page can begin with front matter between two --- lines:
---
title: Hello, world
date: 2026-10-04
layout: post
draft: false
---
titledefaults to the file name.dateisYYYY-MM-DD.layoutnames a file inlayouts/. Without it, a page uses the layout named for its folder (content/posts/useslayouts/posts.html), thenlayouts/default.html.draft: trueleaves the page out of the build.slugreplaces the last part of the page's address.
Front matter supports key: value lines, quoted text, numbers, true, false, and lists as
[a, b] or - item lines. A line it cannot read fails the build and names the file and line.
Templates
Templates use Twig. These variables are available:
site:title,description,language,base,url,pages(every page, newest first) andsections(pages grouped by their first folder, such assite.sections.posts).page:title,description,date,url,section, and every other front matter key.content: the page body as HTML.
Start links with {{ site.base }} so they work wherever the site is served. A layout can extend or include
another by name, for example {% extends "default.html" %}.
Templates run with a short list of allowed features. They can use if, for, set, block, extends
and include, and common filters such as date, join, default and sort. Macros, ranges such as
1..10, the block() function and calls to methods are not available, and a layout cannot include itself.
A build that uses one fails and names the layout.
What Magpie adds
404.htmlis built fromlayouts/404.htmlwhen that file exists.feed.xmllists the newest pages incontent/posts/that have a date.sitemap.xmllists every page.
Versions, publishing and download
Each successful build is a version in the website's Versions band, named for the push that made it, and becomes the live version at once. A build that fails keeps its log in the band and does not change the live site, so a mistake in a push does not take the site down. Restore brings an earlier version back; Download ZIP gives any version's files.
Team admins can show the website at a domain the team owns from Custom domain in More; see Show your website at your own domain.
A build is limited to 5,000 repository files, 60 MB in total and 12 MB per file, and to 2,000 pages; a build over a limit fails and its log says which.
To remove the website, choose More, then Move to Trash, on its page. Its address stops working straight away, and restoring it from Trash brings it back published if it was. Its repository is not moved to Trash with it.
Websites made from a repository before Websites had files websites open the same way: their builds are their versions, oldest first. If a push does not produce a version, Contact support.
Demander à l’assistance Magpie
Envoyez à l’équipe Magpie une question sur tout ce que cet article n’explique pas.