Show the blog on your own pages
v0.0.3
The blog ships as seventeen components. Eleven are blocks that read posts, categories, tags, comments, bloggers and teams on their own, and six are small pieces the blocks share. Setting the blog up also writes nine sample pages that arrange them. This guide places a blog block on a page you build, links its posts to a post page, and makes a page that shows each post, category, tag, blogger or team.
Before you begin
- Set the blog up on your site. The components exist only on sites where it has been set up.
- Sign in with an account that can open the page builder. See Build a page in the visual editor.
- Publish at least one post, so the blocks have something to show.
To see the blocks at work first, open the sample blog page at /en/blog, with your site's language in place of en.

The sample Blog page draws the search bar, the featured strip and the post list, each one a block.
Add a blog block to a page
- Open a page in the visual editor, as in Build a page in the visual editor.
- In the left panel, open Components and type
blogin Search components…. The blog's components carry a T badge, because they belong to this site. - Drag
blog-post-listonto the canvas. - Select it and open the Inspector. Under Props, set
headingto the words above the list andper_pageto how many posts one page holds. - To list one category only, set
collectionto the category's slug. To list one tag only, settagto the tag's slug. - Publish the page.
The block reads its posts itself, so you do not wire any data to it. It shows the first page as soon as the page loads, and later pages and sorting load in the background. See Blog components and sample pages for every attribute.
Link the records to their pages
A block links a post, a category, a tag, a blogger or a team at the site's own page for that kind: the page whose This page shows each is set to it, as the next section shows. The link is filled from the record with the slug, language, date, number and category that page's path names. You set nothing on the block, and a link to a translation leads to that language's address.
- Where the site has no page for a kind, the block draws plain words for it.
- To link under a page of your own instead, set the base attribute for that kind to the path, without the slug:
post_base,category_base,tag_base,author_baseorteam_base. Write:langin the path and the block fills it with the language of the record it links to. A base you write wins over the site's page. - Set
open_besideonblog-post-listorblog-featured-postsand a post opens beside the block, on the page it is already on, with its slug under thepost_paramquery key, for ablog-post-detailon the same page to read. Without it, a post opens on a page of its own.
Make a page that shows each record
A page at /:lang/blog/:slug can show any post, because the address captures the slug. Tell the CMS what the slug names, and the blog fills in the page's title, description, image, structured data and permissions from the record.
- In the admin, open Pages and click the pencil icon, Edit, on the page's row, or add one. The dialog opens on its Configuration tab.
- Set Path to an address that captures the slug, such as
/:lang/blog/:slug. A post page may also capture:year,:monthnum,:day,:post_idand:category. See Choose where posts are read. - In This page shows each, choose Post under Blog. The other choices are Collection, Tag, Blogger and Team, and, for a page that lists records instead of showing one, Blog home and People. Links to the blog's front page and to the people page go to the page you mark with those two. The default, Custom page: one page, one address, makes no link to a record.
- Save the page.
- Put the post block on the page, with
post_paramset toslugand thelanguageset to the page's language.

The choice under Blog tells the page which kind of record its slug names.
When you preview the page, it offers up to eight of the site's latest records of that kind, in the languages the site publishes in, to try the page with.
The sample post page is written in HEEx. These are its three blocks, with site set to the name of your site. None of them names a base, because each link goes to the site's own page for its kind:
<.component
component_name="blog-post-detail"
site="my-site"
id="blog-post"
current_user={assigns[:current_user]}
page_source={assigns[:page_source]}
params={@query_params}
post_param="slug"
language={@page.language}
/>
<.component
component_name="blog-post-comments"
site="my-site"
id="blog-post-comments"
params={@query_params}
post_param="slug"
language={@page.language}
current_user={assigns[:current_user]}
page_source={assigns[:page_source]}
/>
<.component
component_name="blog-related-posts"
site="my-site"
id="blog-post-related"
current_user={assigns[:current_user]}
page_source={assigns[:page_source]}
params={@query_params}
post_param="slug"
language={@page.language}
/>Pass language to all three blocks, as the sample page does. A post belongs to one language, so /fa/blog/<english-slug> then finds nothing, instead of showing the English article and its comments on a Persian page. Pass current_user so that a post locked to a permission is hidden from readers who cannot open it.
Pass page_source={assigns[:page_source]} so the blocks take the post the page already read, instead of each reading it again. Write assigns[:page_source] and not @page_source, because the admin's preview assigns no rows. A block without it still works and reads for itself.

The sample post page draws the article, its comments and the posts to read next.
Next steps
- Blog components and sample pages: every attribute, and the nine sample pages.
- Set a post's SEO and share image.
- Choose where posts are read.
- Page source: read a page's rows once: what
page_sourcecarries. - Start a blog: the whole path on the CMS side.