# How Lotline Works

## How Lotline Works

**Skill level:** Everyone · **Time:** 10 minutes

Read this page once and the rest of the theme gets much easier to follow. Lotline is built from a few simple ideas that repeat everywhere.

### The Big Picture
Lotline is a **static site**: when you run `npm run build`, it turns your text files into finished HTML pages in `dist/`. There is no database and no admin panel. Your files are the website.

```text
config.toml ──► site settings, [business] details, [listings], forms, layouts
menu.en.json ─► header and footer links
theme.css ────► colors, type scale, breakpoints
properties/ ──► one file per home: price, facts, photos, agent, neighborhood

ROUTE  src/pages/[...lang]/index.astro
  │    which sections, in which order
  │
  ├─ PAGE  src/content/homepage/english/-index.md
  │        title, SEO, named blocks
  │
  └─ each SECTION
       ├─ default: sections/english/hero-section.md
       ├─ + page block: heroSection: { ... }
       └─ look: options.layout (many sections)

Base.astro wraps every page:
  head · header · page · call to action · footer · cookie banner
```

### 1. Routes Decide What A Page Shows
Each file in `src/pages/[...lang]/` is one page (a **route**). It lists the sections that page shows, top to bottom. This is the main homepage, `src/pages/[...lang]/index.astro`, shortened:

```astro
<Base {...homepageContent?.data} className="home-1 panel-rhythm" footerReveal layoutSwitcher>
  <LayoutVariants section="hero" content={heroSection} />
  <LayoutVariants section="logos" content={logosSection} />
  <LayoutVariants section="listings" content={listingsSection} />
  <LayoutVariants section="video" content={videoSection} />
  <LayoutVariants section="whyUs" content={whyUsSection} />
  <LayoutVariants section="services" content={servicesSection} />
  <LayoutVariants section="reviews" content={reviewsSection} />
  <LayoutVariants section="enquiry" content={enquirySection} />
  <LayoutVariants section="faqs" content={faqSection} />
</Base>
```

To **reorder** sections, move a line. To **remove** a section from one page, delete its line or set `enable: false` in the page's block for it. The `[...lang]` folder name means one file builds every language: English at `/`, French at `/fr/`, Arabic at `/ar/`.

Sections that have more than one layout are drawn through `<LayoutVariants section="..." content={...} />`. Keep that wrapper when you move them.

### 2. Sections Have Default Content
Every section has a matching content file in `src/content/sections/<language>/`. For example, `ListingsSection.astro` reads `listings-section.md`. That file holds the section's default text, buttons, and options, with comments that explain them.

Edit a section file and the change appears **everywhere that section is used**, unless a page overrides it. Set `enable: false` at the top of the file to hide the section on every page.

### 3. Pages Can Override Any Section
A page file can change a section **for that page only** with a **named block**. This is part of the main homepage file:

```yaml
# src/content/homepage/english/-index.md
---
heroSection: # defaults: hero-section.md (title, text, photo, search labels)
  enable: true
  options:
    layout: "photo-search" # photo-search | framed | panel

listingsSection: # defaults: listings-section.md
  enable: true
  source: "featured"
  limit: 6
  options:
    layout: "grid" # grid | carousel | tabs
---
```

Block names are the section name in camelCase: `heroSection`, `listingsSection`, `reviewsSection`, `faqSection`, `ctaSection`, and so on. Most blocks have a comment that names the section file they override (`# defaults: hero-section.md`). [Sections](/lotline/customization/sections/) has the full list.

A block with a wrong name is ignored without an error. Copy block names from the page file, the [Sections](/lotline/customization/sections/) table, or `sectionsSchema` in `src/sections.schema.ts`.

<Aside type="caution" title="A block only works where the route uses it">
  Adding `listingsSection:` to the valuation page does nothing, because
  `valuation.astro` does not render the listings section. Check the route file
  to see which blocks a page reads.
</Aside>

### 4. How Overrides Merge
When a page block meets the section's default content, Lotline merges them with four rules:

| You write in the page block            | Result                                                         |
| -------------------------------------- | -------------------------------------------------------------- |
| A text or number (`title: "Hello"`)    | Replaces the default value                                     |
| An object (`button:`, `options:`)      | Merges key by key: only the keys you write change              |
| A list (`list:`, `steps:`, `services:`) | Replaces the **whole** list. Write every item you want to keep |
| An empty string (`description: ""`)    | **Clears** the value. Leave the key out to keep the default    |

So this block switches the listings to a carousel on one page and keeps all its text and buttons:

```yaml
listingsSection:
  enable: true
  options:
    layout: "carousel"
```

Keep `enable: true` at the top of each page block, as the shipped files do. A `ctaSection:` block without `enable: true` hides the call to action above the footer on that page.

### 5. Layouts Change The Look, Not The Content
Many sections can be drawn in more than one way. The layout is one option:

```yaml
options:
  layout: "framed" # the hero: photo-search | framed | panel
```

The allowed values are in the comment next to `layout:`, and the full list is in `layoutOption([...])` for that section in `src/sections.schema.ts`. Most content fields stay the same, so you can switch back and forth. Set the layout in the section file (every page) or in a page block (one page).

Open `/elements/` on your local site to see every layout side by side. See [Section Layouts](/lotline/customization/section-layouts/) for every value.

### 6. Base Wraps Every Page
`src/layouts/Base.astro` adds the parts that every page shares:

- the `<head>`: title, description, Open Graph tags, structured data, fonts, and your `[head]` scripts
- the header in one of three layouts (`[settings.layout] header` in `config.toml`, or `headerLayout` in a page), with the menus and the phone number from `[business]`
- the call to action above the footer, from `call-to-action.md` and the page's `ctaSection` block
- the footer in one of three layouts (`[settings.layout] footer`, or `footerLayout` in a page), from the menu files, `[business]`, `src/config/social.json`, and `src/i18n/<language>.json`. Every footer layout also has the Ask AI row (`[settings.pageActions]`) and the theme credit (`[settings.themeCredit]`)
- the cookie banner, the back-to-top button, the motion script (when `[effects] motion` is on), and shared scripts

### 7. Agency Details Are Set Once
Your agency name, phone, email, address, and opening hours live in `[business]` in `config.toml`. The header, footer, contact page, forms, structured data, and `llms.txt` all read them from there.

Inside Markdown text you can write `{name}`, `{phone}`, `{email}`, `{address}`, or `{hours}`, and Lotline fills in the value from `[business]`. The tokens work in `.md` files, not in `.mdx` files, because MDX reads `{…}` as code.

### 8. Listings Link Everything Together
Each home in `src/content/properties/` names its agent and neighborhood by file name. From those two lines, the theme builds the links in both directions:

- the property page shows the agent's card and links to the neighborhood guide
- an agent's page lists every home that names them as `agent`
- a neighborhood page lists the homes and agents that point at it, and the neighborhood cards show how many homes are listed there

Prices are plain numbers. The currency, the number format, and the area unit come from `[listings]` in `config.toml`, so you never type a `$` or `sq ft` into a listing. See [Properties](/lotline/customization/properties/).

### 9. Small Interface Text Lives In i18n Files
Labels that are not page content, such as the header button ("Book a valuation"), the filter labels, form messages, the footer description and copyright, and the 404 text, live in `src/i18n/<language>.json`. The SEO tagline and description of each language are there too. Several `config.toml` labels are empty on purpose (`label = ""`): empty means "use the translated text from the i18n file". Fill them in only if your site has one language.

### 10. Config Is Converted Before Astro Reads It
Astro cannot read TOML, so `npm run dev`, `npm run build`, and `npm run astro-check` first convert `src/config/config.toml` into `.astro/config.generated.json`. While `npm run dev` is running, this happens every time you save `config.toml`, and the page reloads. Always edit the TOML file, never the generated JSON.

Restart `npm run dev` after you change `trailingSlash` or `[settings.multilingual]`, after you add a language, and after you change `src/config/fonts.json`. Astro reads those only when it starts.

### 11. Collections Hold The Repeated Content
A **collection** is a folder of similar entries, each one a file. Lotline's collections are `properties`, `developments`, `agents`, `neighborhoods`, `services`, `reviews`, `careers`, `blog`, `pages`, `homepage`, `about-us`, `contact`, `faq`, and `sections`. They are defined in `src/content.config.ts`, and most have a **schema**: the list of fields an entry may have. See [Collections](/lotline/customization/collections/).

### 12. What Happens During A Build
<Steps>

1. `config.toml` is converted to JSON.
2. Astro checks the content collections that have a schema, including the named blocks in their page frontmatter. A wrong value there, such as a listing `type` that isn't on the list, stops the build with the file name and field. The `sections` and `contact` collections have no schema, so a wrong value in those files is not reported. Check those pages in the browser.
3. Every route is rendered once per language into `dist/`. A page without its own `image` gets a generated Open Graph card.
4. `llms.txt`, `llms-full.txt`, the Markdown copies of pages, the sitemap, `robots.txt`, and the RSS feed are written.
5. Yellow warnings print for anything still a placeholder: `[site]` for the `https://example.com` site URL, `[forms]` for a placeholder form address, and `[business]` for a value it could not read.
6. Draft pages are removed from the sitemap.

</Steps>

### Development vs. Production
Some things behave differently while you work with `npm run dev`:

| Feature                         | `npm run dev`                       | Built site (`npm run build`)          |
| ------------------------------- | ----------------------------------- | ------------------------------------- |
| Pages with `draft: true`        | Shown, so you can preview them      | Not built                             |
| Changes to `config.toml`        | Shown when you save. Restart after changing languages, `trailingSlash`, or fonts | Read at the start of every build |
| Placeholder form address        | A warning box inside the form, and a `[forms]` line in the terminal | A `[forms]` line in the build output |
| Site URL warning                | Not shown                           | Printed when the build finishes, while the URL is `example.com` |
| Open Graph cards for each page  | Not generated                       | Generated during the build            |
| Forms                           | Sent to the address in `config.toml`, so test with care | Same |

### Find Where Any Text Comes From
See a sentence on the site and want to change it? Search the whole project for it: in VS Code press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F</kbd> (<kbd>⌘</kbd> + <kbd>Shift</kbd> + <kbd>F</kbd> on Mac) and paste a few words. It will be in one of these places, checked in this order:

1. The page's own file, in a named block (`src/content/<page>/<language>/-index.md`, or `src/content/pages/<language>/` for single pages such as `/valuation/`)
2. The section's default file (`src/content/sections/<language>/`)
3. A collection entry (`src/content/properties/`, `developments/`, `agents/`, `neighborhoods/`, `services/`, `reviews/`, `careers/`, `blog/`)
4. The interface text (`src/i18n/<language>.json`)
5. The menus (`src/config/menu.<language>.json`)
6. Site settings and agency details (`src/config/config.toml`)

If the same text appears in both a page block and a section file, the page block wins on that page. If you can't find a phone number, an address, or opening hours anywhere in `src/content/`, it comes from `[business]` in `config.toml`.