---
url: /modules/blog.md
---
# Blog

Posts with categories, an author, a publish date and an optional expiry, written with the block editor. The module adds a posts block for list pages and gives every post its own URL.

::: glance

* **Module key** `blog`
* **Default** on
* **Switch** `EVOLVE_MODULE_BLOG`, see [Modules](/modules/#switching-a-module-on-or-off)
* **Role access** `evolve.roles.modules.blog`
* **Panel** `/evolve/blog/post`, `/evolve/blog/category`
  :::

## Configuration

| Variable | Default | Panel | Effect |
|---|---|---|---|
| `BLOG_ALLOW_BLOCKS` | `true` | no | Show the block editor on posts. Off, a post has only its fields and intro. |
| `BLOG_PAGINATION_PER_PAGE` | `6` | no | Posts per page in the built-in list route. |
| `BLOG_OVERVIEW_PAGE` | unset | yes | ID of the CMS page that carries the posts block. The built-in list route redirects there. |
| `BLOG_AUTHOR_TYPE` | `user` | yes | Where author information comes from: `user` for panel users, `company` for members of the [Company](/modules/company) module. |
| `BLOG_ROUTE_PREFIX` | `news` | no | URL segment of post detail pages, `/{locale}/news/{slug}`. |

"Panel" marks the keys the Settings screen edits. The others are set in the `.env` or in a published `config/blog.php`.

## In the panel

* **Posts** at `/evolve/blog/post`: title, slug, intro, category, author, publish date, "valid to" date, featured flag, active flag, layout, and the block editor. Inactive posts and posts past their "valid to" date are not shown on the site.
* **Categories** at `/evolve/blog/category`.
* Cmd-K: "Posts", "Categories" and "New post" (also found with "article" or "Artikel"). Posts are part of the global search.

![The posts list of the Blog module](/screenshots/modules-blog-posts.png)

## On the site

* **Posts block** ("Alle Beiträge", `blog.posts`): title, intro text, an optional category filter, and the choice between all posts and featured posts. The list loads through Livewire and pages through `api/blog/post`.
* **Detail pages** at `/{locale}/news/{slug}`. The head carries the post's meta tags, including `article:author`.
* **Built-in list route** `/{locale}/blog`, paged with `BLOG_PAGINATION_PER_PAGE`. With `BLOG_OVERVIEW_PAGE` set it redirects to that page instead.

The usual setup: create a page, add the posts block, set `BLOG_OVERVIEW_PAGE` to that page in Settings.

## Publishing

| Tag | Publishes |
|---|---|
| `blog.config` | `config/blog.php` |
| `blog.components` | the block definition to `config/components/`, the Livewire components and frontend views |
| `blog.blueprints` | `BlogPosts.php` to `app/Blueprints` |

Publish only to change something. A published view no longer follows package updates.

## Verifying

Create a post, set it active with a publish date in the past, and open `/{locale}/news/{slug}`. `php artisan route:list --path=blog` lists the panel and frontend routes.
