How to set blog as the default homepage?

shadythgod - 3 months ago

I want to know how can I set my Blog page as the default homepage on my website? I am using PyroCMS v2.2.5 Community

ryanthompson - 3 months ago

First thing you will want to do is make sure you don't have a home page in pages. Toggle that off.

Next just route the posts index. One way to do this would be in your routes/web.php file that Laravel loads:

Route::get('/', [
    'as'   => 'anomaly.module.posts::posts.index',
    'uses' => 'Anomaly\PostsModule\Http\Controller\[email protected]',
]);

Note that the named part (the Route::get('/', [ 'as' => 'anomaly.module.posts::posts.index', 'uses' => 'Anomaly\PostsModule\Http\Controller\[email protected]', ]); value) is included. This will make sure any routes referred to by the same name will also point here.

ryanthompson - 3 months ago

Actually.. this file is loaded first so while this works fine it will not override the named part correctly. The resources/REF/routes.php file is loaded last so that would be a good place to put this in order for it to actually OVERRIDE the named route that posts makes.

Then {{ url_route('anomaly.module.posts::posts.index') }} will point home if you want it to (other wise leave that out).

ryanthompson - 3 months ago

@shadythgod oops.. you're using v2.2 sorry man totally missed that! I don't know that you can. \_(ツ)_/¯

A custom route probably still but will need to write your own controller / view.

carsonsuite - 3 months ago

Easily that is lol. @shadythgod My advice is to make a view for the homepage just like blog homepage feeding in the blog data natively by looping over posts.

carsonsuite - 3 months ago

If this is a new development, come aboard v3 :)

shadythgod - 3 months ago

@carsonsuite , i would like to move to v3 but i cant find any proper documentation on upgrading; can you link me to one?