diff --git a/src/SeoToolkit.Umbraco.Site/SeoToolkit.Umbraco.Site.csproj b/src/SeoToolkit.Umbraco.Site/SeoToolkit.Umbraco.Site.csproj index 6e4ecc2c..473e5c48 100644 --- a/src/SeoToolkit.Umbraco.Site/SeoToolkit.Umbraco.Site.csproj +++ b/src/SeoToolkit.Umbraco.Site/SeoToolkit.Umbraco.Site.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/SeoToolkit.Umbraco.Site/Views/Author.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Author.cshtml new file mode 100644 index 00000000..41b2777c --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Author.cshtml @@ -0,0 +1,30 @@ +@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage + +@using Clean.Core.Models.ViewModels +@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels + +@{ + Layout = "master.cshtml"; + var authorListPage = Model.Parent as AuthorList; +} + + +@await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, authorListPage.MainImage, null, null)) + +
+
+
+
+ +
+
+ @Model.Name +

@Model.Name

+
+
+ + @Html.GetBlockListHtml(Model.ContentRows) +
+
+
+
\ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/AuthorList.cshtml b/src/SeoToolkit.Umbraco.Site/Views/AuthorList.cshtml new file mode 100644 index 00000000..f0a499c7 --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/AuthorList.cshtml @@ -0,0 +1,12 @@ +@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage + +@using Clean.Core.Models.ViewModels +@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels + +@{ + Layout = "master.cshtml"; +} + +@await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage)) + +@await Html.PartialAsync("~/Views/Partials/authors.cshtml") \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/Components/Contact/Default.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Components/Contact/Default.cshtml index 49ae0d30..b8765271 100644 --- a/src/SeoToolkit.Umbraco.Site/Views/Components/Contact/Default.cshtml +++ b/src/SeoToolkit.Umbraco.Site/Views/Components/Contact/Default.cshtml @@ -1,27 +1,26 @@ @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage -@using Clean.Core.Controllers.Surface @using Clean.Core.Models.ViewModels; -@using Umbraco.Extensions -@using (Html.BeginUmbracoForm("SubmitForm", FormMethod.Post, new { @class = "text-left" })) +@using (Html.BeginUmbracoForm("SubmitForm", "ContactSurface", FormMethod.Post, new { @class = "text-left" })) { -
+
+ -
-
+
+ -
-
+
+ -
-
- +
+
+
} \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/Components/Pagination/Default.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Components/Pagination/Default.cshtml new file mode 100644 index 00000000..ac0eaf50 --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Components/Pagination/Default.cshtml @@ -0,0 +1,48 @@ +@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage + +@using Clean.Core.Models.ViewModels; + + \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/Partials/authors.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Partials/authors.cshtml new file mode 100644 index 00000000..50f9aa4f --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Partials/authors.cshtml @@ -0,0 +1,55 @@ +@inherits UmbracoViewPage + +@using Clean.Core.Helpers +@using Clean.Core.Models.ViewModels; +@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels + +@{ + AuthorList authorList = UmbracoContext.Content.GetAtRoot().DescendantsOrSelf().FirstOrDefault(); + int modelId = Model.Id; + var isAuthorListPage = modelId == authorList?.Id; + var fallbackPageSize = isAuthorListPage ? 10 : 3; + + var pageSize = QueryStringHelper.GetIntFromQueryString(Context.Request.Query, "size", fallbackPageSize); + var pageNumber = QueryStringHelper.GetIntFromQueryString(Context.Request.Query, "page", 1); + var allAuthors = authorList?.Children().Where(x => x.IsVisible()) ?? Enumerable.Empty(); + var pageOfAuthors = allAuthors.Skip((pageNumber - 1) * pageSize).Take(pageSize); + var totalItemCount = allAuthors.Count(); + var pageCount = totalItemCount > 0 ? Math.Ceiling((double)totalItemCount / pageSize) : 1; + +} + +
+
+
+
+
+ @foreach (var author in pageOfAuthors) + { +
+
+
+ @author.Name +
+
+
+

@author.Name

+

@author.MetaDescription

+ + @Umbraco.GetDictionaryValue("Author.ReadMore") + +
+
+
+
+ } +
+
+ + @if (isAuthorListPage) + { + @await Component.InvokeAsync("Pagination", new { totalItems = totalItemCount, url = Model.Url(), pageNumber = pageNumber, pageSize = pageSize }) + } +
+
+
diff --git a/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/codeSnippetRow.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/codeSnippetRow.cshtml new file mode 100644 index 00000000..18855dce --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/codeSnippetRow.cshtml @@ -0,0 +1,30 @@ +@inherits UmbracoViewPage +@using Umbraco.Cms.Core.Models.Blocks + +@{ + var row = Model.Content as CodeSnippetRow; + var settings = Model.Settings as CodeSnippetRowSettings; + if (settings?.Hide ?? false) { return; } + + var spacingClasses = ""; + if (Model.Settings is ISpacingProperties spacing) + { + spacingClasses = Clean.Core.Helpers.SpacingHelper.GetSpacingClasses(spacing.PaddingTop, spacing.PaddingBottom, spacing.PaddingLeft, spacing.PaddingRight, spacing.MarginTop, spacing.MarginBottom, spacing.MarginLeft, spacing.MarginRight); + } + + SmidgeHelper.RequiresCss("~/clean-assets/css/vs2015.css"); + SmidgeHelper.RequiresCss("~/clean-assets/css/highlightjs-copy.min.css"); + SmidgeHelper.RequiresJs("~/clean-assets/js/highlight.min.js"); + SmidgeHelper.RequiresJs("~/clean-assets/js/highlightjs-copy.min.js"); + SmidgeHelper.RequiresJs("~/clean-assets/js/initHighlight.js"); +} + +
+
+
@row.Code
+ @if (!string.IsNullOrWhiteSpace(row.Title)) + { +

@row.Title

+ } +
+
\ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/iconLinkRow.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/iconLinkRow.cshtml new file mode 100644 index 00000000..ab34ffc7 --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/iconLinkRow.cshtml @@ -0,0 +1,15 @@ +@inherits UmbracoViewPage +@using Umbraco.Cms.Core.Models.Blocks +@addTagHelper *, Clean.Core + +@{ + var row = Model.Content as IconLinkRow; + var settings = Model.Settings as IconLinkRowSettings; + if (settings?.Hide ?? false) { return; } +} + +
  • + + + +
  • \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/imageCarouselRow.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/imageCarouselRow.cshtml new file mode 100644 index 00000000..683ccc22 --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/imageCarouselRow.cshtml @@ -0,0 +1,57 @@ +@inherits UmbracoViewPage +@using Umbraco.Cms.Core.Models.Blocks +@using Clean.Core.Extensions + +@{ + var row = Model.Content as ImageCarouselRow; + var settings = Model.Settings as ImageCarouselRowSettings; + if (settings?.Hide ?? false) { return; } + if (row.Images == null || !row.Images.Any()) { return; } + + var spacingClasses = ""; + if (Model.Settings is ISpacingProperties spacing) + { + spacingClasses = Clean.Core.Helpers.SpacingHelper.GetSpacingClasses(spacing.PaddingTop, spacing.PaddingBottom, spacing.PaddingLeft, spacing.PaddingRight, spacing.MarginTop, spacing.MarginBottom, spacing.MarginLeft, spacing.MarginRight); + } + + SmidgeHelper.RequiresCss("~/clean-assets/css/swiffy-slider.min.css"); + SmidgeHelper.RequiresJs("~/clean-assets/js/swiffy-slider.min.js"); +} + +
    +
    +
    +
      + @foreach (var item in row.Images) + { +
    • @item.Content.GetAltText()
    • + } +
    + + + + +
    + + @if (row.Images.Count() > 1) + { + foreach (var image in row.Images.Skip(1)) + { + + } + } +
    + +
    + + @if (row.Images.Count() > 1) + { + foreach (var image in row.Images.Skip(1)) + { + + } + } +
    +
    +
    +
    \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/imageRow.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/imageRow.cshtml new file mode 100644 index 00000000..d207c8f8 --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/imageRow.cshtml @@ -0,0 +1,26 @@ +@inherits UmbracoViewPage +@using Umbraco.Cms.Core.Models.Blocks +@using Clean.Core.Extensions + +@{ + var row = Model.Content as ImageRow; + var settings = Model.Settings as ImageRowSettings; + if (settings?.Hide ?? false) { return; } + + var spacingClasses = ""; + if (Model.Settings is ISpacingProperties spacing) + { + spacingClasses = Clean.Core.Helpers.SpacingHelper.GetSpacingClasses(spacing.PaddingTop, spacing.PaddingBottom, spacing.PaddingLeft, spacing.PaddingRight, spacing.MarginTop, spacing.MarginBottom, spacing.MarginLeft, spacing.MarginRight); + } +} + +
    +
    + @row.Image.Content.GetAltText() + @if (!string.IsNullOrWhiteSpace(row.Caption)) + { +

    @row.Caption

    + } +
    +
    + diff --git a/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/latestArticlesRow.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/latestArticlesRow.cshtml new file mode 100644 index 00000000..c134a92d --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/latestArticlesRow.cshtml @@ -0,0 +1,76 @@ +@inherits UmbracoViewPage +@using Umbraco.Cms.Core.Models.Blocks +@using Clean.Core.Extensions +@using Clean.Core.Helpers + +@{ + var row = Model.Content as LatestArticlesRow; + var settings = Model.Settings as LatestArticlesRowSettings; + if (settings?.Hide ?? false) { return; } + + var spacingClasses = ""; + if (Model.Settings is ISpacingProperties spacing) + { + spacingClasses = SpacingHelper.GetSpacingClasses(spacing.PaddingTop, spacing.PaddingBottom, spacing.PaddingLeft, spacing.PaddingRight, spacing.MarginTop, spacing.MarginBottom, spacing.MarginLeft, spacing.MarginRight); + } + + var pageSize = row.PageSize; + var pageNumber = QueryStringHelper.GetIntFromQueryString(Context.Request.Query, "page", 1); + var allArticles = row.ArticleList.Children
    ().Where(x => x.IsVisible()).OrderByDescending(x => x.ArticleDate) ?? Enumerable.Empty
    (); + var pageOfArticles = allArticles.Skip((pageNumber - 1) * pageSize).Take(pageSize); + var totalItemCount = allArticles.Count(); + var pageCount = totalItemCount > 0 ? Math.Ceiling((double)totalItemCount / pageSize) : 1; +} + +
    +
    + @foreach (var article in pageOfArticles) + { + var author = article.GetAuthor(Umbraco); + bool.TryParse(article.Value("showFullArticleOnListPage", fallback: Fallback.ToAncestors), out var showFullArticleOnListPage); + +
    + +

    + @(!string.IsNullOrWhiteSpace(article.Title) ? article.Title : article.Name) +

    + @if (!string.IsNullOrWhiteSpace(article.Subtitle)) + { +

    @article.Subtitle

    + } +
    + + @if (showFullArticleOnListPage && article.Categories != null && article.Categories.Any()) + { + + @foreach (var category in article.Categories.Select(x => x.Name).OrderBy(y => y)) + { + @category + } + + } +
    + + @if (showFullArticleOnListPage) + { +
    +
    + @Html.GetBlockListHtml(article.ContentRows) +
    +
    + } + +
    + } + + @if (row.ShowPagination) + { + @await Component.InvokeAsync("Pagination", new { totalItems = totalItemCount, url = row.ArticleList.Url(), pageNumber = pageNumber, pageSize = pageSize }) + } +
    +
    + diff --git a/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/richTextRow.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/richTextRow.cshtml new file mode 100644 index 00000000..e33199ce --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/richTextRow.cshtml @@ -0,0 +1,20 @@ +@inherits UmbracoViewPage +@using Umbraco.Cms.Core.Models.Blocks + +@{ + var row = Model.Content as RichTextRow; + var settings = Model.Settings as RichTextRowSettings; + if (settings?.Hide ?? false) { return; } + + var spacingClasses = ""; + if (Model.Settings is ISpacingProperties spacing) + { + spacingClasses = Clean.Core.Helpers.SpacingHelper.GetSpacingClasses(spacing.PaddingTop, spacing.PaddingBottom, spacing.PaddingLeft, spacing.PaddingRight, spacing.MarginTop, spacing.MarginBottom, spacing.MarginLeft, spacing.MarginRight); + } +} + +
    +
    + @row.Content +
    +
    \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/videoRow.cshtml b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/videoRow.cshtml new file mode 100644 index 00000000..8d57cdb6 --- /dev/null +++ b/src/SeoToolkit.Umbraco.Site/Views/Partials/blocklist/Components/videoRow.cshtml @@ -0,0 +1,29 @@ +@inherits UmbracoViewPage +@using Clean.Core.Helpers +@using Umbraco.Cms.Core.Models.Blocks + +@{ + var row = Model.Content as VideoRow; + var settings = Model.Settings as VideoRowSettings; + if (settings?.Hide ?? false) { return; } + if (string.IsNullOrWhiteSpace(row.VideoUrl)) { return; } + + var spacingClasses = ""; + if (Model.Settings is ISpacingProperties spacing) + { + spacingClasses = Clean.Core.Helpers.SpacingHelper.GetSpacingClasses(spacing.PaddingTop, spacing.PaddingBottom, spacing.PaddingLeft, spacing.PaddingRight, spacing.MarginTop, spacing.MarginBottom, spacing.MarginLeft, spacing.MarginRight); + } + + var videoId = VideoUrlHelper.GetVideoId(row.VideoUrl); +} + +
    +
    +
    + @if (!string.IsNullOrWhiteSpace(row.Caption)) + { +

    @row.Caption

    + } +
    +
    + diff --git a/src/SeoToolkit.Umbraco.Site/Views/article.cshtml b/src/SeoToolkit.Umbraco.Site/Views/article.cshtml index adcffa86..e9abfff8 100644 --- a/src/SeoToolkit.Umbraco.Site/Views/article.cshtml +++ b/src/SeoToolkit.Umbraco.Site/Views/article.cshtml @@ -2,11 +2,22 @@ @using Clean.Core.Models.ViewModels @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels +@using Umbraco.Cms.Core +@using Clean.Core.Extensions -@{ Layout = "master.cshtml"; } +@{ + Layout = "master.cshtml"; + var author = Model.GetAuthor(Umbraco); +} -@await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage, Model.AuthorName, Model.ArticleDate)) +@await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage, author.Name, Model.ArticleDate, Model.Categories))
    - @Html.GetGridHtml(Model, "mainContent", "Clean") +
    +
    +
    + @Html.GetBlockListHtml(Model.ContentRows) +
    +
    +
    \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/articleList.cshtml b/src/SeoToolkit.Umbraco.Site/Views/articleList.cshtml index b55301b8..09454dc5 100644 --- a/src/SeoToolkit.Umbraco.Site/Views/articleList.cshtml +++ b/src/SeoToolkit.Umbraco.Site/Views/articleList.cshtml @@ -9,4 +9,15 @@ @await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage)) -@await Html.PartialAsync("~/Views/Partials/latestArticles.cshtml") \ No newline at end of file +@if (Model.ContentRows != null) +{ +
    +
    +
    +
    + @Html.GetBlockListHtml(Model.ContentRows) +
    +
    +
    +
    +} \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/contact.cshtml b/src/SeoToolkit.Umbraco.Site/Views/contact.cshtml index ac330662..6cc6bd25 100644 --- a/src/SeoToolkit.Umbraco.Site/Views/contact.cshtml +++ b/src/SeoToolkit.Umbraco.Site/Views/contact.cshtml @@ -1,10 +1,9 @@ @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage -@using Clean.Core.Controllers.Surface @using Clean.Core.Models.ViewModels @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels -@{ +@{ Layout = "master.cshtml"; var submitted = false; if (bool.TryParse(TempData["Success"]?.ToString() ?? "", out var success)) @@ -15,37 +14,31 @@ @await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage)) -
    - @if (submitted) - { -
    -
    -
    +
    +
    +
    +
    + @if(submitted) + { + @if (success) { -

    Thanks for contacting us. We will be in touch soon.

    + @Model.SuccessMessage } else { -

    There was an error when trying to submit the form. Please try again later.

    + @Model.ErrorMessage } -
    -
    -
    - } - else - { - @Html.GetGridHtml(Model, "mainContent", "Clean") - } -
    + } + else + { + @Model.InstructionMessage +
    + @await Component.InvokeAsync("Contact") +
    -@if (!submitted) -{ -
    -
    -
    - @await Component.InvokeAsync("Contact") + }
    -} \ No newline at end of file + \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/content.cshtml b/src/SeoToolkit.Umbraco.Site/Views/content.cshtml index 0cfa7cd2..6094703d 100644 --- a/src/SeoToolkit.Umbraco.Site/Views/content.cshtml +++ b/src/SeoToolkit.Umbraco.Site/Views/content.cshtml @@ -11,5 +11,11 @@ @await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage))
    - @Html.GetGridHtml(Model, "mainContent", "Clean") +
    +
    +
    + @Html.GetBlockListHtml(Model.ContentRows) +
    +
    +
    \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/error.cshtml b/src/SeoToolkit.Umbraco.Site/Views/error.cshtml index 023f186f..83852383 100644 --- a/src/SeoToolkit.Umbraco.Site/Views/error.cshtml +++ b/src/SeoToolkit.Umbraco.Site/Views/error.cshtml @@ -10,5 +10,11 @@ @await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage))
    - @Html.GetGridHtml(Model, "mainContent", "Clean") +
    +
    +
    + @Html.GetBlockListHtml(Model.ContentRows) +
    +
    +
    \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/home.cshtml b/src/SeoToolkit.Umbraco.Site/Views/home.cshtml index 044cab46..10a4128a 100644 --- a/src/SeoToolkit.Umbraco.Site/Views/home.cshtml +++ b/src/SeoToolkit.Umbraco.Site/Views/home.cshtml @@ -7,11 +7,17 @@ Layout = "master.cshtml"; } -@if (Model.MainContent != null) -{ -
    - @Html.GetGridHtml(Model, "mainContent", "Clean") -
    -} +@await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage)) -@await Html.PartialAsync("~/Views/Partials/latestArticles.cshtml") \ No newline at end of file +@if (Model.ContentRows != null) +{ +
    +
    +
    +
    + @Html.GetBlockListHtml(Model.ContentRows) +
    +
    +
    +
    +} \ No newline at end of file diff --git a/src/SeoToolkit.Umbraco.Site/Views/master.cshtml b/src/SeoToolkit.Umbraco.Site/Views/master.cshtml index 151145a1..dbda0d52 100644 --- a/src/SeoToolkit.Umbraco.Site/Views/master.cshtml +++ b/src/SeoToolkit.Umbraco.Site/Views/master.cshtml @@ -1,38 +1,33 @@ -@using SeoToolkit.Umbraco.ScriptManager.Core.Interfaces.Services -@using SeoToolkit.Umbraco.ScriptManager.Core.Enums -@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage -@inject IScriptManagerService _scriptManagerService +@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage -@{ Layout = null; +@{ + Layout = null; - var renderModel = _scriptManagerService.GetRender(); } + SmidgeHelper.RequiresCss("~/clean-assets/css/styles.css"); + SmidgeHelper.RequiresJs("~/clean-assets/js/scripts.js"); +} - - + @await Html.PartialAsync("~/Views/Partials/metaData.cshtml") + + + + + + + @await SmidgeHelper.CssHereAsync(debug: false) - - - - - - - - - + - - @await Html.CachedPartialAsync("~/Views/Partials/mainNavigation.cshtml", model: Model, cacheTimeout: TimeSpan.FromMinutes(60)) @RenderBody() @await Html.CachedPartialAsync("~/Views/Partials/footer.cshtml", model: Model, cacheTimeout: TimeSpan.FromMinutes(60)) - - - - - + + + + @await SmidgeHelper.JsHereAsync(debug: false) diff --git a/src/SeoToolkit.Umbraco.Site/Views/search.cshtml b/src/SeoToolkit.Umbraco.Site/Views/search.cshtml index 080e4969..2a4f987c 100644 --- a/src/SeoToolkit.Umbraco.Site/Views/search.cshtml +++ b/src/SeoToolkit.Umbraco.Site/Views/search.cshtml @@ -2,11 +2,14 @@ @using Clean.Core.Models.ViewModels @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels +@using Umbraco.Cms.Core +@using Clean.Core.Extensions @inject Umbraco.Cms.Core.IPublishedContentQuery publishedContentQuery -@{ +@{ Layout = "master.cshtml"; - var searchQuery = Context.Request.Query["q"]; + var searchQuery = Context.Request.Query["q"]; + var docTypesToIgnore = new[] { Category.ModelTypeAlias, CategoryList.ModelTypeAlias, Error.ModelTypeAlias, Search.ModelTypeAlias, XMlsitemap.ModelTypeAlias }; } @await Html.PartialAsync("~/Views/Partials/pageHeader.cshtml", new PageHeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage)) @@ -19,15 +22,15 @@
    -
    +
    - +
    @if (!string.IsNullOrWhiteSpace(searchQuery)) { - var results = publishedContentQuery.Search(searchQuery); + var results = publishedContentQuery.Search(searchQuery).Where(x => !docTypesToIgnore.Contains(x.Content.ContentType.Alias)); long resultCount = results != null && results.Any() ? results.Count() : 0; @Html.Raw(string.Format(Umbraco.GetDictionaryValue("Search.Results"), resultCount, searchQuery)) if (resultCount > 0) { @@ -42,15 +45,14 @@ {

    @(result.Content.Value("subtitle"))

    } - @if (result.Content.HasProperty("authorName") && result.Content.HasValue("authorName") && !string.IsNullOrWhiteSpace(result.Content.Value("authorName")) + @if ((result.Content.HasProperty("author") && result.Content.HasValue("author")) || (result.Content.HasProperty("articleDate") && result.Content.HasValue("articleDate") && result.Content.Value("articleDate") > DateTime.MinValue)) { + var author = result.Content.GetAuthor(Umbraco); +