Skip to content
New: Customize your theme with an AI assistant. Read the guide

Listing Search & Filters

Files: [listings] in src/config/config.toml, heroSection in the homepage files, listingsSection blocks · Skill level: Beginner

Visitors find homes in two places: the search form in the hero of each homepage, and the filter bar on /properties/. Both work the same way. The search sends the visitor to /properties/ with the choices in the address, such as /properties/?status=rent&beds=2, and the filter bar reads them. Nothing runs on a server, so the search works on any static host.

The Lotline properties page with the keyword field, status, type, bedrooms and sort filters over the listing cards

Listings Settings

[listings] in config.toml sets how every price and area looks, everywhere:

[listings]
currency = "USD"
locale = ""
areaUnit = "sq ft"
propertiesPerPage = 0
maxPricesSale = [400000, 600000, 800000, 1000000, 1500000, 2000000]
maxPricesRent = [1250, 1500, 2000, 2500, 3000, 4000]
SettingWhat it does
currencyThe ISO code of every listing price, development “from” price and rent, such as "USD", "EUR", "GBP". One currency for every language
localeHow prices and areas are written, such as "en-US". Empty follows the page language, so French pages write 1 920 000 $US
areaUnitThe unit after floor areas: "sq ft" or "m²". The area number in each listing is in this unit, so change the numbers too if you switch
propertiesPerPageListings shown at first on /properties/. 0 shows them all. Any other number adds a “Show more homes” button
maxPricesSale, maxPricesRentThe steps in the “Max price” list on /properties/ and in the framed home search. Rents are per month

Keep propertiesPerPage = 0 unless you list a lot of homes. The filters work on the homes in the page, and with 0 they see every one of them.

Two more things come from other places:

  • The area unit in other languages: “sq ft” shows as “pi²” on French pages and “قدم²” on Arabic pages. The words are listings.units in src/i18n/<language>.json. m² stays as it is, and any other unit prints as you typed it.
  • The “/mo” after a rent is listings.perMonth in src/i18n/<language>.json.

Salaries on job pages and the currency in structured data come from [settings.currency]. Set its code to the same currency as [listings].

The Filter Bar On /properties/

The bar has a keyword field and five selects:

FieldURL parameterValues
KeywordqAny words. Every word must match the title, the address, the neighborhood, the type, the status or the badge of a listing
Statusstatussale, rent, or empty for all homes
Typetypehouse, apartment, townhouse, villa, penthouse, studio. Only the types your listings use are offered
BedroomsbedsThe minimum: 1, 2, 3 or 4
Max pricemaxThe highest price, or the highest monthly rent with status=rent
SortsortNewest (default), price-asc, price-desc

The max price field shows once a status is picked, because sale prices and rents don’t mix. A max value from a link that isn’t one of your steps gets its own option, so ?status=sale&max=750000 still works.

The choices stay in the address as the visitor changes them, so a filtered search can be bookmarked or sent to someone. Without JavaScript every home stays visible, newest first.

The labels (“All homes”, “Any type”, “Sort by”, the result count) are listings.filters in src/i18n/<language>.json.

Any link can open /properties/ already filtered. The Properties menu does this:

/properties/?status=sale homes for sale
/properties/?status=rent homes for rent
/properties/?type=townhouse townhouses
/properties/?status=rent&beds=2&max=2500 2+ bed rentals up to $2,500 a month
/properties/?q=Riverside homes in Riverside

Use these in menus, buttons and blog posts. See Menus.

The Home Searches

Each homepage hero has its own search form. All three send the visitor to action (/properties/ by default) with the parameters above.

Hero layoutFieldsWhere the settings are
photo-search (/)A Buy / Rent choice and a keyword fieldsearch in sections/<language>/hero-section.md
framed (/home-2/)A Buy / Rent choice, a keyword field, a property type select and a max price selectsearch and searchFilters in heroSection of homepage/<language>/home-2.md
panel (/home-3/)A neighborhood select, a bedrooms select and a max rent select, with a fixed statussearch in heroSection of homepage/<language>/home-3.md
search:
enable: true
action: "/properties/"
label: "Search homes" # read by screen readers
placeholder: "Neighborhood, street or keyword"
button: "Search homes"
statusLabel: "I want to" # read by screen readers
sale: "Buy" # empty `sale` or `rent` hides the toggle
rent: "Rent"

framed

The framed hero uses the same search labels, plus searchFilters for the fields beside the keyword:

searchFilters:
keyword:
label: "Location"
type:
enable: true
label: "Property type"
any: "Any type"
price:
enable: true
label: "Max price"
any: "Any price"

Its max price steps are maxPricesSale and maxPricesRent from [listings], and they switch with the Buy / Rent choice. Set enable: false to drop the type or price field.

panel

The panel hero shows a search card with a title. status is sent with every search (the rentals home sends rent). Each select in filters has a label, an any option that sends nothing, and its options:

search:
enable: true
action: "/properties/"
title: "Find a place to rent"
status: "rent" # sale | rent
button: "Show rentals"
filters:
area: # one option per neighborhood, sent as `q`
label: "Neighborhood"
any: "Any neighborhood"
beds:
label: "Bedrooms"
any: "Any"
options:
- { label: "2 or more", value: "2" }
max:
label: "Max rent"
any: "No limit"
options:
- { label: "$2,000 a month", value: "2000" }

The neighborhood list fills itself from your neighborhood files. The bedroom and rent options are typed here, so write the labels in each language file and keep the value a plain number. A select with no options is hidden.

Listings Sections

The listings section on each homepage picks its homes with three fields:

src/content/sections/english/listings-section.md
source: "featured" # featured | all | sale | rent
ids: [] # file names in the order to show, to pick homes by hand
limit: 6 # 0 = every listing
FieldWhat it does
sourcefeatured: listings with featured: true. all: every listing. sale, rent: one status
idsFile names of listings, in the order you want. Set it to choose the homes by hand
limitHow many to show. 0 shows every one. Default 6
buttonThe button under the cards, “See all properties” by default
tabsThe tabs layout only: one tab per status, in order. Each has a status, an optional label, and an optional button for that tab. limit counts per tab
src/content/homepage/english/home-3.md
listingsSection:
title: "Homes on the market"
tabs:
- status: "rent"
- status: "sale"
limit: 3
options:
layout: "tabs"

Do It With AI

Set up the listing search on my Lotline site: currency [CODE], area unit [sq ft or m²],
max price steps for sale [LIST] and for rent per month [LIST]. Edit [listings] in
src/config/config.toml and set [settings.currency] code to the same currency. If I switch the
area unit, convert the area number in every file in src/content/properties/. Then update the
bedroom and max rent options of the heroSection search in src/content/homepage/*/home-3.md in
every language, and run npm run astro-check.
Type something to search...