Skip to content

Collection pages

A collection page is one page that becomes many: one page per blog post, per product, per team member. You design the page once. When you publish, Silex creates one page for each item of a list from your data source.

How it works

A collection page is a normal page with two settings, in its Page settings (gear icon next to the page in the Pages panel):

  • Page data, in the CMS tab: the list to use, for example posts. Each item of the list gets its own page.
  • Permalink, in the General tab: the URL of each page, built from the item, for example blog/ followed by the post's id.

A blog with 100 posts gives 100 pages.

Setting up a collection page (example: blog)

You need a data source first: see Connecting a data source.

The field names below (posts, data, id, title, body) come from a test API. Your CMS has its own names. When you click + in an expression, the menu lists the real fields. Pick the closest ones.

Step 1: Create the page

  1. Open the Pages panel and click + next to Pages
  2. Name the page, for example Post, and click Ok

Step 2: Set the Page data

  1. In the Pages panel, click the gear icon next to the page name. This opens the Page settings. They are not the Element settings (gear icon at the top of the right panel)
  2. Open the CMS tab
  3. Under Page data, click + and pick the list, for example posts, then the field that holds the list, if there is one: its type ends with [], like data (post[])
  4. Click Apply at the bottom of the Page settings window

The Collection Pages list, below the page list in the Pages panel, now has one entry per item. The next time you open the CMS tab, the text below the field says how many items the list has, for example 100 objects with id, title, body.

The CMS tab of the Page settings: Page data set to posts, then data, which gives 100 objects with id, title, body

Step 3: Set the Permalink

  1. Open the Page settings again (gear icon next to the page name), and stay in the General tab
  2. Under Permalink, click Expression
  3. Click + and pick Page item (Post) (in the group Website's states). Its name ends with the type of your items, so with your CMS it can be different. Then pick a field that is different for each item, like id or a slug
  4. To put the pages in a blog/ path, click + at the end and pick prepend. Click the … next to prepend. In the small window that opens, click Fixed next to Prefix, type blog/ and click Apply
  5. Click Apply at the bottom of the Page settings window

The text below the field shows the URL of the item shown on the canvas. In the picture below, the canvas shows the second post, so the URL is blog/2.

The General tab of the Page settings: Permalink in Expression mode, set to Page item (Post), id, prepend, which gives blog/2

Step 4: Show the item on the page

  1. From the Blocks panel, drag a Text onto the page
  2. Open the Element settings (gear icon at the top of the right panel)
  3. In Properties, click Expression next to HTML content
  4. Click +, pick Page item (Post) (in the group Website's states), then title
  5. Do the same with a second Text, and pick body instead of title

Page item is the item of the current page: on the page of post 2, it is post 2.

Step 5: Check each item in the editor

In the Collection Pages list of the Pages panel, click an entry: the canvas shows the page with that item.

Step 6: Publish

Publish your site. Each item gets its own page: with the settings above, post 1 is at /blog/1/, post 2 at /blog/2/, and so on.

If you leave Permalink empty, it depends on where you publish:

  • From the online editor, the URLs use the page name and a number. The first item is at /post/, the second at /post/1/, the third at /post/2/.
  • From Silex Desktop, with the default settings, the site is not published. A message asks you to set the Permalink in the page settings, General tab.

Good to know

  • The pages are static. They are created at publish time. When you add a post in your CMS, publish again to get its page.
  • Page data takes only a list. Unlike Permalink, it has no filters: you cannot sort the list or keep only some items there.
  • The Pages panel has no folders. The path of the URLs (blog/, products/) comes from the Permalink.
  • Size, under Deprecated in the CMS tab, is the number of items per page. Leave it at 1 for one page per item.

Learn more

Edit this page on GitLab