Data sources, newsletter and coordinates

Show data that changes outside the site, such as opening hours, prices or a status, in blocks of your pages; send newsletter sign-ups from the server; and give map blocks their coordinates.

For site owners and developers · any Pro plan · Administrator · Checked with Leitvia 1.2.69, Leitvia Studio 1.3.65 and Leitvia Pro 0.8.55

Data in a page

A content type of the site as the source of a Data list. The video has no sound; the transcript below has the text of every step.
Transcript of the video
  1. Under Pro, tab Data sources, content types and products are sources by themselves.
  2. In a page, add the block Data list from the inserter.
  3. Choose the source and the fields; the list renders on the server with the time of the data.

Data sources

A data source is a list of records, such as your branches with their opening hours. Three kinds exist:

KindIDContent
RemoteYour choice, such as branchesA JSON or CSV file from an HTTPS address
Content modelmodel/<post type>Published entries of a content type with title, address and every field
WooCommerceproductsPublished products with name, address, prices, SKU, stock and rating

Content model and WooCommerce sources appear by themselves. A remote source you add like this:

  1. Open Leitvia Studio › Pro, tab Data sources.
  2. Under Add a source, enter an ID (lowercase letters, digits, hyphens), a Name and the Address of the file. It starts with https://.
  3. Choose the Format, JSON or CSV.
  4. For JSON, fill Path to the list only when the list sits deeper in the file (see the example below).
  5. Set the Refresh interval in minutes, from 1 to 1440. The default is 15.
  6. Choose Save and fetch. The table above the form then shows the number of records and the time of the fetch.

In this file the list sits under data, then items, so the path is data.items. A nested object becomes a field with a dot, here address.city:

{
  "data": {
    "items": [
      { "name": "Hamburg harbour", "open": "8 to 18", "address": { "city": "Hamburg" } },
      { "name": "Bremen centre", "open": "9 to 17", "address": { "city": "Bremen" } }
    ]
  }
}
The tab Data sources of the screen Leitvia Pro before the first source: a note on what a source is and the form Add a source with ID, name, address, format, path to the list, refresh interval and the button Save and fetch.
A source after Save and fetch: records and fields are known.
The tab Data sources with a red error notice above the form Add a source, because the address of the new source points to a host that is not public.
A source that cannot be fetched. The notice names the reason.

Show the data

  • Data list: the records of a source as a table or a list. Add the block, choose the source and the fields.
  • Data map: records with coordinates on a map. Map tiles load only after the visitor agrees.
  • The block binding Live data: one field of one record in a paragraph, heading, image or button. An AI agent usually sets it for you.
The block editor with the block Data list on a new page: the records of the chosen source as a table, and in the settings on the right the field Source and the choice of the fields to show.
The block Data list in the editor, rendered with real records.
Markup of the binding Live data

The source is leitvia-pro/data. match picks the first record whose field has that value, row picks one by its position (0 for the first). The field _updated gives the time of the data.

<!-- wp:paragraph {"metadata":{"bindings":{"content":{"source":"leitvia-pro/data","args":{"source":"branches","field":"open","match":"name=Hamburg harbour"}}}}} -->
<p>Opening hours follow.</p>
<!-- /wp:paragraph -->

The blocks show when the data was fetched, so visitors see how old it is. Content model sources hold published entries only. Sample entries of a kit are drafts until you publish them, and until then the list says No data is available right now.

Limits and safety

  • Only https:// on the standard port, a public host and no redirect.
  • At most 1 MB, 500 records and 1000 characters per value. A fetch waits 5 seconds at most.
  • If a refresh fails, the last good records stay in use for up to a week, with their old time.
  • Your server fetches the data. The browser of a visitor never talks to the host of a source. Use public data only: everything a source holds can show on the site.

Newsletter

The block Newsletter sign-up sends addresses to the service you choose. Set it up like this:

  1. Open Forms and customers, tab Newsletter.
  2. Under Service, choose Newsletter (WordPress plugin), Klaviyo, Mailchimp or Brevo.
  3. For Klaviyo, Mailchimp or Brevo, enter the API key and the List ID. Brevo also needs the number of its Double opt-in template. The WordPress plugin needs neither.
  4. Choose Save Changes, then add the block Newsletter sign-up to a page.

With Newsletter (WordPress plugin), the plugin Newsletter on your site keeps the addresses and sends the confirmation email. With an external service, your server sends each address, so visitors never connect to the service. Then you need an agreement on data processing with it, and double opt-in turned on for the list.

The tab Newsletter of the screen Forms and customers with the fields Service, API key, List ID and Double opt-in template and the button Save Changes.
The newsletter service of the site.

Coordinates

A Data map needs latitude and longitude for each entry. Pro fills them from the address:

  1. Open Leitvia Studio › Pro, tab Coordinates.
  2. Choose the service: Nominatim (OpenStreetMap, no key) or Geoapify (EU, with API key).
  3. Under Fields per content type, pick the fields for address, latitude and longitude. Choose None to leave a type out.
  4. Choose Save Changes. From now on, saving an entry in the editor with an address and empty coordinates fills them in.

Only the address and the language of the site go to the service, never anything about visitors. AI agents use the ability Look up coordinates (leitvia-pro/geocode), which writes into a change package.

The tab Coordinates of the screen Leitvia Pro with the choice of the service, the API key field for Geoapify and the table Fields per content type with address, latitude and longitude for each content type.
Coordinates for map blocks.