# Blog posts without /home in the path

**URL:** <https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224>\
**Category:** Questions\
**Tags:** v4\
**Created:** [June 10, 2025, 9:19am UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224 "2025-06-10T09:19:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![oppfield](https://avatars.discourse-cdn.com/v4/letter/o/cab0a1/32.png) [@oppfield](https://forum.getkirby.com/u/oppfield)\
**Post date:** [June 10, 2025, 9:19am UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224/1 "2025-06-10T09:19:34Z")

</div>

I would like a clean and simple address for my blog posts without a folder structure.

Currently I have:  
domain.tdl/home/my-blog-post

I would prefer:  
domain.tdl/my-blog-post

How do I set up the blueprints / templates to avoid having ‘home’ show as a directory in the web address?

---

<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:** [June 10, 2025, 10:00am UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224/2 "2025-06-10T10:00:04Z")

</div>

2 options:

- Your blog posts live directly in the content folder instead of having them as children of home
- You redirect the posts via a combination of two routes: [Routes | Kirby CMS](https://getkirby.com/docs/guide/routing#removing-the-parent-page-slug-from-the-url).  
Additionally (and optionally), you can create a page model for the blog posts where you overwrite the url method to reflect the intended url structure: [Page models | Kirby CMS](https://getkirby.com/docs/guide/templates/page-models)

---

<div class="post-metadata">

**Author:** ![oppfield](https://avatars.discourse-cdn.com/v4/letter/o/cab0a1/32.png) [@oppfield](https://forum.getkirby.com/u/oppfield)\
**Post date:** [June 10, 2025, 12:04pm UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224/3 "2025-06-10T12:04:20Z")

</div>

Close, but something is not quite right. The address part is working (domain.tdl/my-blog-post) but the request is being redirected to the error page. I’m using the page models method?

/site/models/article.php

```auto
<?php
class ArticlePage extends Page {
  public function url($options = null): string {
    return $this->slug();
  }
}

```

/site/templates/home.php

```auto
<?php foreach ($page->children()->listed()->sortBy('date', 'desc') as $article): ?>
	<a href="<?= $article->url() ?>"><?= $article->title() ?></a>
<?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:** [June 10, 2025, 12:26pm UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224/4 "2025-06-10T12:26:55Z")

</div>

> [@oppfield](#):
>
> The address part is working (domain.tdl/my-blog-post) but the request is being redirected to the error page.

This only works in conjunction with the routes, simply changing the url will indeed go to the error page.

---

<div class="post-metadata">

**Author:** ![oppfield](https://avatars.discourse-cdn.com/v4/letter/o/cab0a1/32.png) [@oppfield](https://forum.getkirby.com/u/oppfield)\
**Post date:** [June 10, 2025, 1:04pm UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224/5 "2025-06-10T13:04:15Z")

</div>

Ah, apologies… now I understand, Its working now 🙂

---

<div class="post-metadata">

**Author:** ![oppfield](https://avatars.discourse-cdn.com/v4/letter/o/cab0a1/32.png) [@oppfield](https://forum.getkirby.com/u/oppfield)\
**Post date:** [June 10, 2025, 2:03pm UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224/6 "2025-06-10T14:03:43Z")

</div>

Can I use the same method with a tag in the URL?

For example:  
domain.tdl/journal lists articles with the tag ‘journal’

---

<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:** [June 10, 2025, 2:20pm UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224/7 "2025-06-10T14:20:43Z")

</div>

> **[Filtering via routes](https://getkirby.com/docs/cookbook/collections/filter-via-route)**
>
> Learn how to filter using routes instead of parameters

---

<div class="post-metadata">

**Author:** ![oppfield](https://avatars.discourse-cdn.com/v4/letter/o/cab0a1/32.png) [@oppfield](https://forum.getkirby.com/u/oppfield)\
**Post date:** [June 10, 2025, 3:41pm UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224/8 "2025-06-10T15:41:09Z")

</div>

A little stuck rendering posts with a tag of ‘journal’ using home:

Address: /home/post-1  
Rewriten to: /post-1  
Template: article.php

When I click on a tag, say ‘journal’ and render an address of /journal I get an error page (/site/template/default.php) instead of the home page.

I’ve added a route for journal but obviously going wrong somewhere:

/site/config/config.php

```auto
<?php

return [
    'routes' => [
        
        [
            'pattern' => '(:any)',
            'action' => function($uid) {
                $page = page($uid);
                if(!$page) $page = page('home/' . $uid);
                if(!$page) $page = site()->errorPage();
                return site()->visit($page);
            }
        ],
        [
            'pattern' => 'journal',
            'action' => function ($tag) {
                return page('home')->render([
                    'tag' => $tag
                ]);
            }
        ]
        
    ]
];

```

/site/models/article.php

```auto
<?php
class ArticlePage extends Page {
  public function url($options = null): string {
    return $this->slug();
  }
}

```

---

<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:** [June 10, 2025, 4:51pm UTC](https://forum.getkirby.com/t/blog-posts-without-home-in-the-path/34224/9 "2025-06-10T16:51:00Z")

</div>

Well, the `journal` route would have to come before `(:any)`, because `(:any)` already catches it, so no need for Kirby to try the next route, unless you specifically call the next route if you encounter an error in the first.
