How to set blog as the default homepage?
Created 7 years ago by shadythgod

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  —  7 years 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\PostsController@index',

Note that the named part (the as value) is included. This will make sure any routes referred to by the same name will also point here.

ryanthompson  —  7 years 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  —  7 years 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  —  7 years 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  —  7 years ago

If this is a new development, come aboard v3 😄

shadythgod  —  7 years ago

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