Add news, live weather and a form
For builders who have added pages. It covers the three kinds of data a page can show: data files kept in the site’s folder, live data the platform fetches, and form entries visitors send. At the end, Saltmere Marina has a news list with a page for each post, the weather at the marina kept up to date, and a form boat owners use to ask about a slip.
Content that repeats or changes often is kept apart from the page design, so a change to a post or a price touches one small file, not the HTML around it.
| Kind | Where it lives | When the page gets it |
|---|---|---|
| Data files | In the site’s folder, under _data |
When the site is built |
| Live data | On the platform, which fetches it from another service | Each time a visitor opens the page |
| Form entries | On the platform, sent by visitors | Never on a page: they go to the business’s Leads in its account, and by email |
1. News posts, each with its own page
Section titled “1. News posts, each with its own page”Each news post is one file in _data/news/. Make _data/news/2026-11-02-fuel-dock.md:
---title: The new fuel dock is opendate: 2026-11-02slug: fuel-dock---Diesel and gas are now at the end of B dock, open 7 a.m. to 7 p.m. Diesel is $1.79 a litre.The settings between the --- lines become fields of the post. The text below them is the post’s body, written in Markdown. You choose the fields. The file’s name only sets the order of the list: files are listed by name, so a date at the start keeps them in date order. In YAML, put prices in quotes, such as price: "$1.79", so they print exactly as written.
Run ws preview. Its first line says ws wrote the folder’s schema, _data/news.schema.yml. A schema is a short file that lists the fields every post has and the kind of value each holds:
title: { kind: text, translate: true }date: { kind: date }slug: { kind: slug, translate: true }body: { kind: markdown, translate: true }From then on, ws push refuses a post that does not match, such as one with published: where the others have date:, and names the file and field. So every agent that adds a post uses the same fields. The owner’s account, where the owner of a bought site can edit posts, also uses the schema, to show a date field as a calendar. translate: true marks the fields written in each language, used in part 5. To add a field that some posts leave out, such as a photo, add it to the schema with optional: true. A post without it reads it as empty, so {% if post.photo %} skips the posts that have none. The text below a post’s --- lines is its body, so a schema you write yourself lists body too, as the one ws writes does.
A data file can also be one YAML or JSON file, such as _data/hours.yml, which pages read as data.hours. A single file has no schema.
Now give each post a page. Make news/[slug].html:
---layout: defaulteach: newstitle: "{{ item.title }}"---<h1>{{ item.title }}</h1>{{ item.body | markdown }}layout: default wraps each page in the site’s main layout, _layouts/default.html, as on other pages. each: news makes one page for every post in data.news. On each page, item is that post. The [slug] in the file name is filled from each post’s slug field, so this post is at /news/fuel-dock. markdown turns the post’s Markdown into HTML, and drops any script in it.
Any field can name the page, such as [id].html. Its values must use lowercase letters, numbers and hyphens. If a post has no value for that field, a value breaks that rule, or two posts share one, the build stops and names the files.
Run ws preview again and open /news/fuel-dock on the preview.
2. The latest news on the home page
Section titled “2. The latest news on the home page”Pages read the posts as data.news, a list. Add the latest three to the home page, in index.html:
<h2>News</h2>{% assign posts = data.news | sort: "date" | reverse %}{% for post in posts limit: 3 %} <article> <h3><a href="{{ post.url }}">{{ post.title }}</a></h3> <p>{{ post.date | date: "%B %-d, %Y" }}</p> </article>{% endfor %}post.url is the address of the page step 1 made for that post, /news/fuel-dock. A post has a url only when its list has a page for each post, so without news/[slug].html the build stops at post.url and says to add that page. The date prints as “November 2, 2026”. Dates use the site’s time zone and the page’s language, and a date with no time is never moved to another day.
Everything printed with {{ }} is printed as text. A post title such as “Fish & Chips content, a file from this site’s _includes folder, which holds parts its pages share, such as the header, put into a page with {% render %}, the markdown filter’s result, and a {% live %} block, below. The values inside a {% live %} block are still printed as text. The Reference page has the details.
Run ws preview and tap the post’s title on the home page to open its page.
3. The weather at the marina
Section titled “3. The weather at the marina”Live data comes from a source the platform runs. At launch there is one, the weather:
ws sourcesweather Current weather and forecast, from Environment and Climate Change Canada. Free. Ready for any site.More sources, such as an owner’s Google reviews or real estate listings, come later. The weather needs no account, so it works on a sample site the business has not bought yet. Connect it to the marina’s town:
ws sources connect weather "Mahone Bay NS"Connected weather to Lunenburg, the nearest of Environment Canada's 844 places.Now: temperature, wind, humidity, updated.Forecast, in periods: name, summary, temperature, text.Shows: "Data Source: Environment and Climate Change Canada". Keep it on the page.Environment Canada’s City Page Weather service reports the weather for 844 places in Canada, in English and French, so ws picks the place nearest the town. The connection is a site setting, so everyone who works on the site shares it. It is saved with the site now. When you next publish, the saved copy of the site that publishing makes, called a version, includes it. Show the weather and the next few forecast periods on the home page:
{% live 'weather' %} <p>At the marina: {{ live.item.temperature }} °C, wind {{ live.item.wind }}. Updated {{ live.item.updated | date: "%-I:%M %p" }}.</p> <ul> {% for period in live.items limit: 4 %} <li>{{ period.name }}: {{ period.summary }}</li> {% endfor %} </ul> <p><small>{{ live.credit }}</small></p>{% fallback %} <p><a href="https://weather.gc.ca">Weather for Saltmere</a></p>{% endlive %}A source gives one record, a list of records, or both. live.item is one record, here the weather now. live.items is a list, here the forecast, such as “Tonight: Mainly cloudy” and “Sunday: Rain”, and you loop over it with {% for %} like any list.
When a visitor opens the page, the platform’s server renders the part between {% live %} and {% fallback %} with the newest weather, and puts it into the page before sending it. The page needs no JavaScript to show it. The platform fetches new weather at least every 10 minutes. If the weather service cannot be reached, the page shows the last weather it got, up to 3 hours old. After that it shows the part after {% fallback %}. live.credit prints the line the weather service asks every site to show.
4. A form for boat owners
Section titled “4. A form for boat owners”A form is a plain HTML form that posts to the platform. Add this one to about.html:
<form method="post" action="/_ws/forms/slip-request"> <input type="hidden" name="thanks" value="/thank-you"> <label>Name <input name="name" required></label> <label>Email <input name="email" type="email" required></label> <label>Boat length, in feet <input name="boat-length" type="number"></label> <button>Ask about a slip</button></form>The action is what makes this a form the platform captures. Only a form that posts to an address starting with /_ws/forms/ sends its entries to the platform and gets the platform’s spam field. Any other form, such as a search box a script handles, is left alone. Formspree and Basin work the same way.
slip-request, the last part of the action, is the form’s name: any lowercase name, with hyphens. Nothing needs to be set up first. You choose the fields. A few names have a meaning: a field named email becomes the address replies go to, the hidden field named thanks picks the page shown after sending, and names starting with _ws belong to the platform. Here thanks sends visitors to /thank-you. Make that page as thank-you.html, with layout: default and a short thank-you message, like about.html. Without that field, the visitor comes back to the same page with “Thank you, your message was sent.” above the form.
The platform checks the required fields of the form as it served it. If a script disables a field when a visitor makes a choice, either leave required out of the HTML and set it in the script when the field is enabled, or keep required and add data-ws-may-disable to that field, so the platform does not require it (Reference).
The platform saves each entry, then emails it. Once the business has bought its site, entries go to its owner: the person at the business who signs in to manage it. The owner also reads them under Leads in their account. Until then, entries go to the builder who made the site, and they never show under Leads. The platform also adds a hidden field to the form. People never see it, so an entry that fills it in came from a spam program and is dropped.
Paths that start with /_ws/ belong to the platform, on every site.
Run ws preview and fill in the form on your phone. On a preview, the entry goes only to you, with “[Preview]” in the subject.