Member sites are not storefront themes. A site can’t use a theme’s files, settings or stylesheets, and
fluid theme commands don’t touch it. See the overview.Know the folder
A site holds six kinds of file. In the CLI, each lives in a folder of the same name, and a path in the folder is the path the file API uses.- No subfolders. A name uses lowercase letters, digits, hyphens and underscores. Names that start with a dot are ignored.
- A page is a file and a row.
pages/<slug>.liquidholds the content, and a row inconfig/pages.jsonholds the slug, title, position, published flag, layout and menu. A new page needs both. A site holds at most 50 pages. - The home page’s slug is
/inconfig/pages.json, and its file ispages/index.liquid. A slug is neverindex.
Pick a layout
A page uses its row’slayout, else the site’s default layout, else layouts/site.liquid. The layout name none renders the page with no layout. A missing layout falls back to site: see Pages and menus.
A layout prints the page where it writes content_for_layout, and Fluid’s head content where it writes content_for_header:
layouts/site.liquid
content_for_header carries what the page needs in its <head>: the site SDK that installs window.fluid, and a link to assets/site.css when the site has that file. A page with no layout can print content_for_header too.
Read the Liquid objects
A page and its layout render with the same objects.- Every
urlis a path on your company’s domain, such as/accounts/rileys-shop/about. Use it as written in links. - An unpublished page isn’t listed. A page with
published: falseisn’t insite.pages,site.pages_menuor any menu. - Don’t read member data in Liquid. Don’t read
memberormember.<field>in a layout, section, snippet or page. Member data is leaving member site Liquid, andfluid member-site lintwarns on everymember.<field>it finds. Read the viewer’s data in a script. - Keep members’ data out of settings.
config/settings.jsonis the same for every viewer.
settings.menu:
snippets/nav.liquid
Use tags and filters
A site’s Liquid reaches its own files only.
A page template can use a section, a snippet and a settings value together:
pages/index.liquid
{% schema %} block. Lint checks it, and the pairing of block tags such as {% if %} and {% endif %}.
Know the frame’s rules
Every page renders in an iframe on your company’s domain with this policy:- No cookies and no storage. A site’s JavaScript has no cookie, and reading
document.cookiethrows. It has nolocalStorageorsessionStorage. Don’t build sign-in, “remember me” or any state that relies on them, and never put a token or other credential in Liquid, settings or an asset. - Scripts and forms only. The sandbox grants scripts and forms. The browser also blocks popups,
alertandconfirmdialogs, and navigation of the top page. - Fluid draws the account menu. It appears outside the frame on every page, even a page with the layout
none. No template can hide or replace it, so don’t build a second account menu or a sign-out link. - Link inside the site. Use
site.pagesand menuurlvalues. A click navigates inside the frame. - Reach Fluid with
fluid.fetch. The frame has no cookie, so the page’s ownfetchto a Fluid API carries no session and fails. Callwindow.fluid.fetch(path, init)instead, which behaves likefetch. See Read viewer data in site scripts.
Use text assets only
A site holds text assets only:css, js, json, txt and html files in assets/, valid UTF-8 and not empty. A push refuses any other file.
Don’t put an image, a font, a PDF or a video in the folder, and don’t inline one as a large base64 string. Upload images and fonts to your company’s media library and use the URL it gives you, in an <img src>, in background-image: url(...) and in an @font-face src.
assets/site.css
Preview and publish
Page content, layouts, sections, snippets and settings are drafts until you publish the site, and members see only the published copies. See Publish a site. To see a draft, runfluid member-site dev, or use the draft preview operations of the member API or the company API.