# Homepages

## Homepages

**Files:** `src/pages/[...lang]/index.astro`, `home-2.astro`, `home-3.astro`, `src/content/homepage/english/` · **Skill level:** Beginner to edit, light code to reorder

Lotline has three homepages, one for each kind of agency. They use the same sections with different content, layouts, header and footer, so each one also shows which combination suits that agency. Keep one as your homepage and delete the others, or keep a second one as a landing page.

| Homepage | URL | Route file | Content file |
| -------- | --- | ---------- | ------------ |
| Agency home (main) | `/` | `src/pages/[...lang]/index.astro` | `src/content/homepage/english/-index.md` |
| Fine homes and new developments | `/home-2/` | `src/pages/[...lang]/home-2.astro` | `src/content/homepage/english/home-2.md` |
| Rentals and property management | `/home-3/` | `src/pages/[...lang]/home-3.astro` | `src/content/homepage/english/home-3.md` |

Each content file has a copy in each other language folder, such as `src/content/homepage/french/`. The **Homepages** flyout in the **Company** menu links to all three.

### Agency Home (Main Homepage)
<div class="border border-dark">
  ![Lotline agency homepage with the photo search](/images/lotline/home.jpg)
</div>

For an agency that sells and rents homes in a few neighborhoods. A full-width photo with a Buy and Rent search under the `overlay` header.

Sections, top to bottom, with the layout set in `-index.md`:

1. Hero, `photo-search`: a photo, the headline, Buy and Rent tabs and a keyword search (`heroSection`)
2. Client logos, `band`: a lime band with a moving row of logos (`logosSection`)
3. Listings, `grid`: the homes marked `featured: true`, six at most (`listingsSection`)
4. Video, a poster with a quote from the founder (`videoSection`)
5. Why us, `card-over-photo` (`whyUsSection`)
6. Services, `photo-cards`: Buying, Selling and Renting (`servicesSection`)
7. Reviews, `carousel` (`reviewsSection`)
8. Inquiry form, `forest`: the form on a pine panel with your email and phone (`enquirySection`)
9. FAQ, `centered` (`faqSection`)
10. CTA, `photo`, above the footer (`ctaSection`)

Header `overlay`, footer `columns`, which slides out from under the page at the end.

The video section shows its poster without a play button until you set `videoUrl` in `src/content/sections/english/video-section.md` to a YouTube or Vimeo link, or a file in `public/videos/`.

### Fine Homes And New Developments
<div class="border border-dark">
  ![Lotline developments homepage with the framed search](/images/lotline/home-2.jpg)
</div>

For an agency that sells larger homes and new-build developments for their builders. A centered headline on sage paper, a search bar with location, type and price, and a wide photo under it.

1. Hero, `framed`: headline, Buy and Rent tabs, a search with **Location**, **Property type** and **Max price**, and a wide photo (`heroSection`)
2. Stats, `band`: four figures (`statsSection`)
3. Listings, `carousel`: homes for sale, featured first (`listingsSection`)
4. Developments, `split`: a development with its photo and key facts (`developmentsSection`)
5. Neighborhoods, `grid`: photo tiles with the number of homes listed in each (`neighborhoodsSection`)
6. Agents, `row` (`agentsSection`)
7. Reviews, `quote`: one large quote at a time, from buyers and sellers (`reviewsSection`)
8. Blog, `row`: the newest posts (`blogSection`)
9. CTA, `pine`: news on Parkline Terraces, with a "Join the interest list" button (`ctaSection`)

Header `bar`, footer `pine` with the newsletter row.

### Rentals And Property Management
<div class="border border-dark">
  ![Lotline rentals homepage with the rental search card](/images/lotline/home-3.jpg)
</div>

For a lettings office that finds tenants and manages homes for their owners. A pine hero with a rental search card beside a framed photo.

1. Hero, `panel`: headline, and a **Find a place to rent** card with neighborhood, bedrooms and max rent (`heroSection`)
2. Listings, `tabs`: **For rent** and **For sale** tabs, three homes each (`listingsSection`)
3. How it works, `row` (`stepsSection`)
4. Services, `list`: one row per service with its fee line (`servicesSection`)
5. Why us, `rows`: why landlords stay (`whyUsSection`)
6. Inquiry form, `card` (`enquirySection`)
7. Reviews, `grid`, from tenants and landlords (`reviewsSection`)
8. FAQ, `split` (`faqSection`)
9. CTA, `lime` (`ctaSection`)

Header `utility` (the pine strip with phone, email and hours), footer `minimal`. The pine of the hero fades into sage paper as you scroll into the listings.

The hero's search card sends visitors to `/properties/` with `status=rent` and their choices. The **Max rent** options are typed in `home-3.md`, so update them if your rents differ. See [Listing Search & Filters](/lotline/customization/listing-search/).

### Reviews On Each Homepage
Every homepage has its own `reviewsSection` block, and its `filter` decides which reviews from `src/content/reviews/` it shows. Each review file names its `service`, so a homepage can show only the reviews that match its kind of work:

```yaml
# src/content/homepage/english/home-3.md
reviewsSection:
  filter:
    service: "" # one service id; empty = every service
    services: ["renting", "property-management"] # used when `service` is empty
    area: "" # one neighborhood id; empty = every neighborhood
  limit: 3
```

| Homepage | Reviews shown |
| -------- | ------------- |
| `/` | Every review, up to 8 in the carousel |
| `/home-2/` | `buying` and `selling`, 3 |
| `/home-3/` | `renting` and `property-management`, 3 |

The service ids are the file names in `src/content/services/english/`: `buying`, `selling`, `renting`, `property-management`, `valuations` and `relocation`. When you add your own reviews, set their `service` to one of these so they land on the right homepage. A section with no matching review is hidden.

### How A Homepage Gets Its Content
Each homepage content file holds one **named block** per section (`heroSection:`, `listingsSection:`, ...). A block overrides the section's default file in `src/content/sections/english/` for this page only, and picks the section's look with `options.layout`:

```yaml
# src/content/homepage/english/-index.md
heroSection: # defaults: hero-section.md (title, text, photo, search labels)
  enable: true
  title: "Homes in Springfield, with an agent who *knows* the street"
  options:
    layout: "photo-search" # photo-search | framed | panel
```

- Objects merge key by key, so a block only needs the fields it changes.
- A list replaces the whole list: repeat every item you want to keep.
- `enable: false` hides that section on this homepage.

The first homepage keeps most of its text in the section files (`hero-section.md`, `listings-section.md`, ...), and its blocks mostly pick layouts. The other two write their own text in their blocks. Either way, change every language. The allowed layouts are in the comment next to each `layout:`, and `/elements/` previews them. More in [Sections](/lotline/customization/sections/) and [Section Layouts](/lotline/customization/section-layouts/).

### Reorder Or Remove Sections
The order of the sections is set in the route file, not the content file. From `index.astro`:

```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>
```

Move a line up or down to move the section. Delete a line to remove it, or set `enable: false` in its block instead, which is easier to undo. Keep the `<LayoutVariants section="..." content={...} />` wrapper: it renders the layout you set in `options.layout`. The `ctaSection` block is not in the list, because it is the call to action above the footer. `footerReveal` makes the footer slide out from under the page, and you can delete it to turn that off.

In `home-3.astro`, the hero and the listings sit inside a `<div class="home-band" data-band ...>` wrapper. That wrapper makes the pine fade into sage paper as the page scrolls. Keep both sections inside it, or remove the wrapper and keep the two lines.

### Use Another Homepage As Your Homepage
<Steps>

1. **Copy the route.** Replace the contents of `src/pages/[...lang]/index.astro` with the contents of the homepage you want, for example `home-2.astro`. In the copied code, change the entry name from `"home-2"` to `"-index"`:

   ```astro
   const homepageContent = await getEntryCTM("homepage", "-index", Astro.currentLocale);
   ```

2. **Copy the content.** Replace the frontmatter of `src/content/homepage/english/-index.md` with that of `home-2.md`, then set `title: ""`. The browser title comes from `metaTitle`, so set that to your homepage title. Do the same in the other language folders.

3. **Delete the homepages** you don't keep: the route files in `src/pages/[...lang]/` and the content files in every language folder of `homepage/`.

4. **Update the menus.** Remove the **Homepages** flyout from the **Company** menu in every `menu.<language>.json`.

5. **Check it.** Run `npm run astro-check` and open `/`, `/fr/` and `/ar/`.

</Steps>

<Aside type="tip" title="Keep an extra homepage as a landing page">
  You can keep `/home-3/`, for example, as a page for landlords. All three
  homepages are open to search engines. Rename the route file and the content
  files if you want another URL, and link to it from your menu.
</Aside>

### Header And Footer Per Homepage
Each homepage picks its header and footer in its content file. They win over `[settings.layout]` in `config.toml`:

| Homepage | `headerLayout` | `footerLayout` |
| -------- | -------------- | -------------- |
| `/` | none (uses the default, `overlay`) | none (uses the default, `columns`) |
| `/home-2/` | `bar` | `pine` |
| `/home-3/` | `utility` | `minimal` |

When you copy a homepage into `-index.md`, these lines come with it. Delete them to use the site defaults. The `overlay` header turns transparent over a photo at the top of the page, so it suits the `photo-search` hero. Over the `framed` and `panel` heroes it shows as a solid bar. See [Header](/lotline/customization/header/) and [Footer & CTA Band](/lotline/customization/footer/).

### Do It With AI
```text
On the main homepage (src/pages/[...lang]/index.astro), move the [SECTION] line above the
[SECTION] line and remove the [SECTION] line. Then rewrite the hero text in
src/content/sections/english/hero-section.md for my agency: [ONE PARAGRAPH]. Keep every key,
option and list length, and at most one *accent* word in the title. Do the other language
files too.
```

```text
Make the /home-[2 | 3]/ design my homepage. Replace src/pages/[...lang]/index.astro with the
contents of home-[N].astro, reading the "-index" entry. Copy the frontmatter of
src/content/homepage/english/home-[N].md into -index.md (same for the other language folders)
and set title to "". Delete the other homepage routes and content files, remove the
Homepages flyout from the Company menu in each src/config/menu.<language>.json, and run
npm run astro-check.
```