ByteEditor Website Builder

Wiki menu

Footer Customization

By following the steps in this instruction, you will be able to create your custom footer. You can use the code snippets provided in the guide to recreate this footer, or you can modify the steps to tailor the footer to your specific needs.
Footer Option 5

Step 1. Create the footer view

  1. Open the project folder
  2. Open the “Views” → “Partials” folder. It already contains the built-in footers (“footer1.cshtml”–“footer4.cshtml”) and their shared markup (“footerShared.cshtml”).
  3. Create a file named “footer5.cshtml”
  4. Copy the following code and paste it into the file
@using Umbraco.Cms.Core.Models
@using Umbraco.Cms.Core.Models.Blocks
@using Umbraco.Cms.Core.Strings
@{
    var design = ViewData["Design"] as Design;
    var settings = ViewData["Settings"] as Settings;
    var footerBlock = settings?.Footer?.FirstOrDefault(e => e.Content.ContentType.Alias == "footerBlock");
    var footerLinks = footerBlock?.Content.Value<BlockListModel>("footerLinks")?.Select(x => x.Content).OfType<FooterLinksGroup>()
    ?? Enumerable.Empty<FooterLinksGroup>();
    var copyrightMessage = footerBlock?.Content.Value<IHtmlEncodedString>("copyrightMessage")
    ?? new HtmlEncodedString(string.Empty);
    var customCssClasses = footerBlock?.Content.Value<string>("customCssClasses")
    ?? string.Empty;
}
<footer class="footer footer-4 @customCssClasses">
    <div class="container">
        <div class="row">
            <div class="col-12 d-flex justify-content-center pb-4">
                <a class="@(design?.Logo != null ? "d-inline-block position-relative" : "navbar-brand") @(design?.LogoHover != null ? "has-logo-hover" : "")"
                   href="/" style="max-width: 110px; color: var(--footer-link-color);">
                    @await Html.PartialAsync("logo", new ViewDataDictionary(ViewData) { { "imageCropAnchor", ImageCropAnchor.Left } })
                </a>
            </div>
            <div class="col-12">
                <hr class="border-bottom">
            </div>
            <div class="col-lg-7">
                <div class="row">
                    @{
                        RenderFooterLinks(footerLinks, "col-lg-3 d-flex text-center text-lg-start justify-content-center justify-content-lg-start mb-4 mb-md-3");
                    }
                </div>
            </div>
            <div class="col-lg-3">
                @if (footerBlock?.Areas.Any(a => a.Any()) ?? false)
                {
                    @await Html.GetBlockGridItemAreasHtmlAsync(footerBlock)
                }
            </div>
            <div class="col-12">
                <hr class="border-bottom">
            </div>
        </div>
        <div class="pt-4 mt-4 mt-md-2 text-center lead-sm">
            <p class="mb-0 lh-1">@Html.Raw(copyrightMessage)</p>
        </div>
    </div>
</footer>
@functions {
    private void RenderFooterLinks(IEnumerable<FooterLinksGroup>? footerLinks, string divClass)
    {
        foreach (var footerLink in footerLinks ?? Enumerable.Empty<FooterLinksGroup>())
        {
            <div class="@divClass">
                <ul class="footer-nav flex-column">
                    <li>
                        <h5 class="footer-title">@footerLink?.GroupName</h5>
                    </li>
                    @foreach (var link in footerLink?.Links ?? Enumerable.Empty<Link>())
                    {
                        <li>
                            <a class="nav-link p-0" href="@link?.Url" target="@link?.Target">
                                <span class="d-inline-flex gap-2 align-items-center">
                                    @link?.Name
                                    @if (link?.Target == "_blank")
                                    {
                                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right" viewBox="0 0 16 16">
                                            <path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5" />
                                            <path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0z" />
                                        </svg>
                                    }
                                </span>
                            </a>
                        </li>
                    }
                </ul>
            </div>
        }
    }
}

5. Save the file and rebuild the project. Umbraco 17 compiles views when the project is built, so a footer view saved without a rebuild has no effect.

Screenshot At Nov 13 06 10 48

Step 2. Add the footer to the Footer Options list

  1. Open “Settings” → “Data Types” → “Design - Footer Options - Dropdown” (in the “ByteEditor” folder).
  2. Add a new option “footer5”. The option must match the file name of the view, without “.cshtml”.
  3. Click “Save”.

Step 3. Select the footer in your design

  1. Open “Content” → “Design Builder” and open the design your site uses.
  2. In “Footer Options”, select “footer5”.
  3. Click “Save and publish”, then open your site.

💡 The footer's colours come from the “Footer” colours of your design in the Design Builder, so the new footer follows the theme without any extra CSS.

💡 In the back office, the Footer block preview (Settings → Footer) shows one of the built-in layouts: a custom footer is only rendered on the website itself.

💡 Upgrading from version 4? The “ByteEditor:CustomFooters” section in “appsettings.json” and the AngularJS “.html” footer view are no longer used in version 17. You can remove them.

Built with ByteEditor