config/. config/pages.json lists the pages, config/menus.json holds the menus, and config/settings.json holds the values your templates read as settings. This page covers what each file holds, how a page picks its layout and menu, and which changes are live at once and which wait for a publish.
You edit these files in the folder the CLI pulls, or you write them through the file API: see Write a site file for members and Write a site file for company sites. The pages API changes one page at a time: see Add a page and Change a page.
Know how a page works
A page is two things:- A row in
config/pages.json. It holds the page’s slug, title, position, published flag, layout and menu. - A file,
pages/<slug>.liquid. It holds the page’s content. The home page’s file ispages/index.liquid.
published: true, and the page’s content must have been published with the site. A page whose row is published but whose content was never published is missing to members, and no list of pages shows it.
Write the pages file
config/pages.json
layout at the top is the site’s default layout name, or null. Each page row holds:
- The CLI needs four keys. A row must have
slug,title,positionandpublished.layoutandmenudefault tonull. Any other key is refused. - The file API needs two. Written through the file API, a row needs only
slugandtitle.positiondefaults to the row’s place in the list,publishedtofalse, andlayoutandmenutonull. - A site holds at most 50 pages. A new page needs a row and a file.
- The home page is
/. Its file ispages/index.liquid, which is why no other page can take the slugindex. If a site has no served home page,/accounts/<site-handle>answers not found for every member, and the/accountslanding skips the site. See Sites home. - Rows are matched by slug. Writing
config/pages.jsonthrough the file API makes the site’s pages match the file. It changes the rows it names, adds new ones with an empty file, and removes every page whose row is missing, with its content. A page you rename is a new page and a removal. - An unpublished page is hidden everywhere. It isn’t in
site.pages,site.pages_menuor any menu, and a visitor who opens its address gets not found. A draft preview shows it.
Pick a layout
A page uses the first of these that applies:- The page row’s
layout. - The site’s default
layout. - The layout named
site, which islayouts/site.liquid.
none renders the page with no layout. A layout name the site has no published layout for falls back to the layout named site, and then to no layout when the site has none. A page never goes blank because a layout is missing.
The layout prints the page where it writes content_for_layout. See Pick a layout.
Write the menus file
A menu is a list of items. A site can hold any number of menus, each with its own slug.config/menus.json
- A menu has a
slug, atitleanditems. The slug is lowercase words joined by single hyphens and unique in the file. The title can’t be empty.itemsis optional. - An item has a
title. It can carry apage, which is the slug of a page inconfig/pages.json(/is the home page), or aurl, which is anhttporhttpsaddress. It never carries both. An item with neither is a heading. - Items nest to any depth. Put children under
items. The order of the list is the order members see. - Every other key is refused. So is an item whose
pagenames no page of the site. - The file replaces every menu. Menus are matched by slug and keep their identity. A menu you leave out is deleted, and the pages that used it lose their menu. To clear every menu, write a file whose
menuslist is empty. - A link to a page the site doesn’t serve is left out, with the items under it. That includes a page that is unpublished. A heading keeps its place and has no link.
Choose which menu a page uses
A page’s templates read its menu assettings.menu. Fluid picks it in this order:
- The menu named in the page row’s
menu. - The menu with the slug
main. site.pages_menu, a menu Fluid builds from the site’s served pages.
site.menus.<slug>, such as site.menus.footer. See Read the Liquid objects for the shape of a menu.
A page row can name only a menu that config/menus.json defines. Push config/menus.json before the row that names a new menu. The CLI does this for you.
Write the settings file
config/settings.json is one JSON object. Templates read it as settings, and Fluid adds settings.menu to it for the page being rendered. Use it for values such as colors and fonts that every viewer sees the same.
- Writing the file replaces the whole object. The site’s
settingsfield in Change a site does the same. - Never put a member’s data in it. The settings are the same for every viewer and are visible to every viewer.
- It always exists. You can write it but not remove it.
Know what is live at once
Some of these files have a draft, and some don’t. A publish makes the drafts live. See Publish a site.
Two things follow:
- A new page isn’t served until you publish. Its row is live at once, but its content is a draft. Members get not found for the page until the next publish.
- Unpublishing a page takes effect at once. Setting
publishedtofalseon a page members already see removes it from the site, from its menus and fromsite.pageswithout a publish.