Customising the home page (moving your content stream to another page) (v2)
10 April 2022 567 views | Documentation v2
Perhaps you don't want to display a content stream on your default home page. Perhaps you would prefer to display a landing page or splash screen there instead, and move the content stream to a custom URL. To do so, follow these steps:
- Create a custom URL for your content stream by setting up a new route - basically copy the '/' entry in the routing table, give it a new name like '/articles/' and add it to the end of the table.
- Edit the templates of your front end theme(s) to include the new path in hyperlinks, so wherever you see TFISH_URL search and replace it to TFISH_URL . 'articles/'.
- Edit trust_path/configuration/config.php and append the new URL path to the value of TFISH_PERMALINK_URL, eg. TFISH_PERMANLINK_URL becomes TFISH_URL . 'articles'. This ensures that your RSS and sitemap links point back to the right page.
Now, to convert your home page to a landing page or something else, you need to edit the base '/' route:
- If you want to use your home page as a landing page, the easiest way is just to assign an alternative layout template. Create your landing page (you could use a copy of layout.html as a starting point and simply remove the main content area to dispense with the dynamic content) and give it a name like layoutHome.html.
- Edit trust_path/libraries/tuskfish/Content/Controller/Listing.php and add a line to the constructor calling setLayout() to specify your landing page layout template (and optionally, a different theme):
public function __construct($model, $viewModel)
{
$this->model = $model;
$this->viewModel = $viewModel;
// Specify an alternative layout file.
$this->viewModel->setLayout('layoutHome');
// Specify an alternative theme.
// $this->viewModel->setTheme('someOtherTheme');
}
- Alternatively, you can setup a custom route displaying some other kind of content, by creating a completely new route as per the link above.
Copyright, all rights reserved.