Question concerning the Blog in Kirby 3.5.1

Hello,

I was wondering if I could use the features of the blog (e.g. tags, categories, summaries, rendering all blog entries together on a page) and yet create a different url?

More explicitely:

Instead of my-site.com/blog/entry
Create my-site.com/entry

Thanks for any help.

Best

Nedim

Yes, that’s possible via routes and additionally optionally a model that creates the modified URL.

Thank you. That works fine.

Follow up question:
what if I have more than one page with subpages?
E.g.: my-site.com/blog/entry, my-site.com/films/entry

How would the config file look like then?

Best,

Nedim

You could use an array of patterns, and you would have to check if the wanted pages is a subfolder either of parent one, two or whatever.

Note that URLs need to be unique, so you have to make sure that your folder slugs between the children of blog and the children of film (and possible other parents), do not collide.

I understand that the URLs must be unique. Bu cannot understand the rest. Missing PHP knowhow. :frowning: Sorry.

This is what I used in the config.php:

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

So if I also want to implement the same for all subpages under the “films” page, would I just duplicate the code above and change “journal” with “films”?

Thank you in advance.

Nedim

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

Thank you very much!