Home page |
Top Previous Next |
Now we will change the home page template to our web site. Right-click the CMSTemplates/MySite folder in the Solution Explorer and click Add new item... Choose to create a new page called Home.aspx and check the box Select master page:
Click Add and choose the MyMaster.master page in the CMSTemplates/MySite folder in the next dialog:
Copy the whole <!-- main content --> section from the home.htm file inside the <asp:Content> element. Now we will remove the text content with editable regions so that it can be managed by content editors:
The complete code will look like this:
Switch to the Design tab and drag and drop two CMSEditableRegion controls on the page: - one into the center cell of the center box - one into the bottom cell of the right box
Set the following properties of the CMSEditableRegion controls:
Switch to the code behind and add reference to the CMS.UIControls namespace:
[C#]
[VB.NET]
You also need to change the class definition so that it inherits from the TemplatePage class:
[C#]
[VB.NET]
Save the changes.
Our master page and page template for the home page are ready. Now we need to register the home page template in Kentico CMS. Open Kentico CMS in a web browser and go to Site Manager (http://localhost/KenticoCMS/CMSSiteManager) -> Development -> Page templates.
Click the root and click New category. Create a new category with name My web site.
Click New template and enter the following values:
Click OK and set the following values on the General tab:
Click OK to save and click the Sites tab. Assign the new page template to your web site and click OK.
Go to CMS Desk -> Content. Click root and click New. Choose to create a new Page (menu item) and enter the following values:
Click Save and Click the Page tab. Now you can see that the page contains two editable regions.
Enter the following text:
Click Save. Click Live site and you will see the home page of your new web site.
Configuring the web site home page
When the site visitor comes to the root of your web site (e.g. to http://www.mydomain.com), the system needs to know which page should be displayed as a home page. Go to Site Manager -> Settings, select My web site, click Web site and make sure the value Default alias path is set to /Home, which is the alias path of our new home page.
|