happy-geeks_geeks-core-library/GeeksCoreLibrary/Modules/Templates/Views/Shared/Template.cshtml
@using GeeksCoreLibrary.Modules.Templates.Enums
@model GeeksCoreLibrary.Modules.Templates.ViewModels.PageViewModel
@* ReSharper disable Razor.SectionNotResolved *@
@section HeaderStyles {
    @{
        if (Model?.Css?.ExternalCss != null)
        {
            foreach (var css in Model.Css.ExternalCss)
            {
                @:<link rel="stylesheet" href="@Html.Raw(css.Uri)" @Html.Raw(!String.IsNullOrEmpty(css.Hash) ? $"integrity='{css.Hash}' crossorigin='anonymous'" : "") />
            }
        }
        if (!String.IsNullOrWhiteSpace(Model?.Css?.GeneralStandardCssFileName))
        {
            @:<link rel="stylesheet" href="@Html.Raw(Model.Css.GeneralStandardCssFileName)" />
        }
        if (!String.IsNullOrWhiteSpace(Model?.Css?.PageStandardCssFileName))
        {
            @:<link rel="stylesheet" href="@Html.Raw(Model.Css.PageStandardCssFileName)" />
        }
        if (!String.IsNullOrWhiteSpace(Model?.Css?.GeneralInlineHeadCss))
        {
            @:<style>@Html.Raw(Model.Css.GeneralInlineHeadCss)</style>
        }
        if (!String.IsNullOrWhiteSpace(Model?.Css?.PageInlineHeadCss))
        {
            @:<style>@Html.Raw(Model.Css.PageInlineHeadCss)</style>
        }
    }
}

@section HeaderScripts {
    @{
        if (Model?.Javascript?.ExternalJavascript != null)
        {
            foreach (var javascript in Model.Javascript.ExternalJavascript)
            {
                <script
                    src="@Html.Raw(javascript.Uri.ToString())"
                    @Html.Raw(javascript.Async ? "async" : "")
                    @Html.Raw(javascript.Defer ? "defer" : "")
                    @Html.Raw(!String.IsNullOrEmpty(javascript.Hash) ? $"integrity='{javascript.Hash}' crossorigin='anonymous'" : "")>
                </script>
            }
        }
        if (!String.IsNullOrWhiteSpace(Model?.Javascript?.GeneralStandardJavaScriptFileName))
        {
            <script src="@Html.Raw(Model.Javascript.GeneralStandardJavaScriptFileName)" defer></script>
        }
        if (!String.IsNullOrWhiteSpace(Model?.Javascript?.PageStandardJavascriptFileName))
        {
            <script src="@Html.Raw(Model.Javascript.PageStandardJavascriptFileName)" defer></script>
        }
        if (!String.IsNullOrWhiteSpace(Model?.Javascript?.GeneralInlineHeadJavaScript))
        {
            <script>
                @Html.Raw(Model.Javascript.GeneralInlineHeadJavaScript)
            </script>
        }
        if (Model?.Javascript?.PageInlineHeadJavascript != null)
        {
            foreach (var javascript in Model.Javascript.PageInlineHeadJavascript)
            {
                <script>
                    @Html.Raw(javascript)
                </script>
            }
        }
    }
}

@section FooterStyles {
    @{
        if (!String.IsNullOrWhiteSpace(Model?.Css?.GeneralAsyncFooterCssFileName))
        {
            <link rel="stylesheet" href="@Html.Raw(Model.Css.GeneralAsyncFooterCssFileName)" async />
        }
        if (!String.IsNullOrWhiteSpace(Model?.Css?.GeneralSyncFooterCssFileName))
        {
            <link rel="stylesheet" href="@Html.Raw(Model.Css.GeneralSyncFooterCssFileName)" />
        }
        if (!String.IsNullOrWhiteSpace(Model?.Css?.PageAsyncFooterCssFileName))
        {
            <link rel="stylesheet" href="@Html.Raw(Model.Css.PageAsyncFooterCssFileName)" async />
        }
        if (!String.IsNullOrWhiteSpace(Model?.Css?.PageSyncFooterCssFileName))
        {
            <link rel="stylesheet" href="@Html.Raw(Model.Css.PageSyncFooterCssFileName)" />
        }
    }
}

@section FooterScripts {
    @{
        if (Model?.Javascript?.GeneralSyncFooterJavaScriptFileName != null)
        {
            foreach (var javascript in Model.Javascript.GeneralSyncFooterJavaScriptFileName)
            {
                <script src="@Html.Raw(javascript)" defer></script>
            }
        }
        if (!String.IsNullOrWhiteSpace(Model?.Javascript?.GeneralAsyncFooterJavaScriptFileName))
        {
            <script src="@Html.Raw(Model.Javascript.GeneralAsyncFooterJavaScriptFileName)" async defer></script>
        }
        if (!String.IsNullOrWhiteSpace(Model?.Javascript?.PageAsyncFooterJavascriptFileName))
        {
            <script src="@Html.Raw(Model.Javascript.PageAsyncFooterJavascriptFileName)" async defer></script>
        }
        if (!String.IsNullOrWhiteSpace(Model?.Javascript?.PageSyncFooterJavascriptFileName))
        {
            <script src="@Html.Raw(Model.Javascript.PageSyncFooterJavascriptFileName)" defer></script>
        }
        if (Model?.Javascript?.PagePluginInlineJavascriptSnippets != null)
        {
            foreach (var javascript in Model.Javascript.PagePluginInlineJavascriptSnippets)
            {
                <script>
                    @Html.Raw(javascript)
                </script>
            }
        }
    }
}

@section MetaData {
    @{
        if (Model?.MetaData?.MetaTags != null)
        {
            foreach (var (name, content) in Model.MetaData.MetaTags)
            {
                <meta name="@name" content="@content" />
            }
        }

        if (Model?.MetaData?.OpenGraphMetaTags != null)
        {
            foreach (var (property, content) in Model.MetaData.OpenGraphMetaTags)
            {
                <meta property="og:@property" content="@content" />
            }
        }

        if (!String.IsNullOrWhiteSpace(Model?.MetaData?.Canonical))
        {
            <link href="@Model.MetaData.Canonical" rel="canonical" />
        }

        if (!String.IsNullOrWhiteSpace(Model?.MetaData?.PreviousPageLink))
        {
            <link href="@Model.MetaData.PreviousPageLink" rel="prev" />
        }

        if (!String.IsNullOrWhiteSpace(Model?.MetaData?.NextPageLink))
        {
            <link href="@Model.MetaData.NextPageLink" rel="next" />
        }
    }
}

@section HeaderGoogleAnalyticsScripts {
    @{
        if (Model?.GoogleAnalytics?.HeadJavaScriptResources != null)
        {
            foreach (var javascript in Model.GoogleAnalytics.HeadJavaScriptResources)
            {
                <script src="@Html.Raw(javascript.Uri.ToString())" @Html.Raw(javascript.Async ? "async" : "") @Html.Raw(javascript.Defer ? "defer" : "")></script>
            }
        }
        if (!String.IsNullOrWhiteSpace(Model?.GoogleAnalytics?.InlineHeadJavaScript))
        {
            <script>
                @Html.Raw(Model.GoogleAnalytics.InlineHeadJavaScript)
            </script>
        }
    }
}

@section BodyGoogleAnalyticsScripts {
    @{
        if (!String.IsNullOrWhiteSpace(Model?.GoogleAnalytics?.InlineBodyNoScript))
        {
            <noscript>@Html.Raw(Model.GoogleAnalytics.InlineBodyNoScript)</noscript>
        }
    }
}

@section HeaderTopWidgets {
    @{
        if (Model?.Widgets != null)
        {
            foreach (var widget in Model.Widgets.Where(w => w.Location == PageWidgetLocations.HeaderTop))
            {
                @Html.Raw(widget.Html)
            }
        }
    }
}

@section HeaderBottomWidgets {
    @{
        if (Model?.Widgets != null)
        {
            foreach (var widget in Model.Widgets.Where(w => w.Location == PageWidgetLocations.HeaderBottom))
            {
                @Html.Raw(widget.Html)
            }
        }
    }
}

@section BodyTopWidgets {
    @{
        if (Model?.Widgets != null)
        {
            foreach (var widget in Model.Widgets.Where(w => w.Location == PageWidgetLocations.BodyTop))
            {
                @Html.Raw(widget.Html)
            }
        }
    }
}

@section BodyBottomWidgets {
    @{
        if (Model?.Widgets != null)
        {
            foreach (var widget in Model.Widgets.Where(w => w.Location == PageWidgetLocations.BodyBottom))
            {
                @Html.Raw(widget.Html)
            }
        }
    }
}

@Html.Raw(Model.Body)