Try our conversational search powered by Generative AI!

[AlloyMVC] Can't hide footer if header is visible

Found in

EPiServer.CMS.Core 10.4.1

Fixed in

EPiServer.CMS.UI 10.10.2

(Or a related package)

Created

Feb 08, 2017

Updated

Jul 07, 2017

Area

CMS UI

State

Closed, Fixed and tested


Description

The Alloy demo templates settings include the ability to hide the header and footer. However, it's impossible to hide the footer only because the _root.cshtml file only hides the footer if the "HideHeader" checkbox is checked.

Steps to reproduce
1. Create a new site using the Alloy demo templates.
2. Edit any page.
3. Go to the Forms view > Settings tab.
4. Check the "Hide site footer" checkbox.
5. Publish.
6. Go back to view mode. Notice the footer is still visible.

To fix

Change this ~/Views/Shared/Layouts/_Root.cshtml

<div class="container">
@if(!Model.Layout.HideHeader)

{ Html.RenderPartial("Header", Model); }
@RenderBody()
@if(!Model.Layout.HideHeader) { Html.RenderPartial("Footer", Model); }
</div>

To this:

<div class="container">
@if(!Model.Layout.HideHeader) { Html.RenderPartial("Header", Model); }

@RenderBody()
@if(!Model.Layout.HideFooter)

{ Html.RenderPartial("Footer", Model); }

</div>