# Add Blog excerpt to home page

**URL:** <https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050>\
**Category:** Questions\
**Tags:** v3\
**Created:** [March 9, 2023, 1:09pm UTC](https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050 "2023-03-09T13:09:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidroberts](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@davidroberts](https://forum.getkirby.com/u/davidroberts)\
**Post date:** [March 9, 2023, 1:09pm UTC](https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050/1 "2023-03-09T13:09:55Z")

</div>

I would like to add the latest blog excerpt to a home page and link to the full post. Could you point me in the direction where I could find out how to do this?  
Many thanks.

---

<div class="post-metadata">

**Author:** ![stffr](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@stffr](https://forum.getkirby.com/u/stffr)\
**Post date:** [March 9, 2023, 1:15pm UTC](https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050/2 "2023-03-09T13:15:04Z")

</div>

> **[Creating a Kirby-powered blog](https://getkirby.com/docs/cookbook/templating/create-a-blog#building-the-templates__blog-php)**
>
> Set up a blog system with an overview, articles, tags, feeds and more.

---

<div class="post-metadata">

**Author:** ![davidroberts](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@davidroberts](https://forum.getkirby.com/u/davidroberts)\
**Post date:** [March 9, 2023, 5:14pm UTC](https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050/3 "2023-03-09T17:14:38Z")

</div>

Yes, I have read that. It just describes how to create a blog and articles not to say have a blog excerpt on a different page.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 9, 2023, 5:20pm UTC](https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050/4 "2023-03-09T17:20:26Z")

</div>

With `page('blog')` you get the blog page, the rest is the same as on the original page.

---

<div class="post-metadata">

**Author:** ![davidroberts](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@davidroberts](https://forum.getkirby.com/u/davidroberts)\
**Post date:** [March 10, 2023, 12:52pm UTC](https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050/5 "2023-03-10T12:52:46Z")

</div>

I have used what I have which is a bit different to the code for creating a blog and it does not work. I get the error message, This page is currently offline due to an unexpected error…

The basic code that I am using for blog.php is:

```auto
<?php foreach ($articles as $article): ?>
   
	 <h1 class="blog-title"><?= $article->title()->link() ?></h1>
	<time class="blog-date"><?= $article->date()->toDate("d F Y") 
<?= $article
  ->text()
  ->excerpt(400, false)
  ->kirbytext() ?>
 
<?php endforeach; ?>

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 10, 2023, 1:04pm UTC](https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050/6 "2023-03-10T13:04:38Z")

</div>

But that doesn’t tell us what you are trying in home.php… You are using `$articles` here, which is probably defined in your home.php controller as `$page->children()->listed()`.

In the home template, you would replace this with `page('blog')->children()->listed()`.

---

<div class="post-metadata">

**Author:** ![davidroberts](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@davidroberts](https://forum.getkirby.com/u/davidroberts)\
**Post date:** [March 10, 2023, 3:27pm UTC](https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050/7 "2023-03-10T15:27:00Z")

</div>

You are using `$articles` here, which is probably defined in your home.php controller as `$page->children()->listed()`.

No, I don’t have that. What I have is the code that I provided, basically. That’s it.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 10, 2023, 3:51pm UTC](https://forum.getkirby.com/t/add-blog-excerpt-to-home-page/28050/8 "2023-03-10T15:51:06Z")

</div>

I’m sorry, but this `$articles` variable must be defined somewhere, it doesn’t exist out of the blue.

But in any case, if in your home.php template you define

```auto
$articles = page('blog')->children()->listed();

foreach ($articles as $article) {
  // you can do the same as in your blog template
}

```
