diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index d06bb8b..23bec4f 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 3.1.401 + dotnet-version: '6.0.x' - name: Install dependencies run: dotnet restore - name: Build diff --git a/Helpers/HtmlHelpers.cs b/Helpers/HtmlHelpers.cs index 68ed6e6..15b16ca 100644 --- a/Helpers/HtmlHelpers.cs +++ b/Helpers/HtmlHelpers.cs @@ -1,10 +1,9 @@ using AngleSharp.Dom; using Kentico.Kontent.Delivery.Abstractions; -using Kentico.Kontent.ImageTransformation; +using Kentico.Kontent.Urls.ImageTransformation; using Kentico.Kontent.Statiq.Memoirs.Models; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Statiq.Common; using System.Collections.Generic; using System.Linq; @@ -59,7 +58,7 @@ public static IHtmlContent Image(this IHtmlHelper html, IAsset asset, string? de imageUrl = imageUrl.WithFitMode(fit.Value); } - tag.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes), true); + tag.MergeAttributes(Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes), true); if (lazy) { diff --git a/MemoirsTheme.csproj b/MemoirsTheme.csproj index 4ef429a..ad5e5c3 100644 --- a/MemoirsTheme.csproj +++ b/MemoirsTheme.csproj @@ -1,15 +1,16 @@ - + Exe - netcoreapp3.1 + net6.0 + enable - - - - + + + + diff --git a/MemoirsTheme.sln b/MemoirsTheme.sln index 70327fe..dae2e97 100644 --- a/MemoirsTheme.sln +++ b/MemoirsTheme.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30413.136 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32407.343 MinimumVisualStudioVersion = 15.0.26124.0 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MemoirsTheme", "MemoirsTheme.csproj", "{FD3E8728-0F91-418E-8CA4-5F37B44FF70B}" EndProject diff --git a/Models/ContentTypes/Post.cs b/Models/ContentTypes/Post.cs index 68463b2..811f245 100644 --- a/Models/ContentTypes/Post.cs +++ b/Models/ContentTypes/Post.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using Kentico.Kontent.Delivery.Abstractions; - namespace Kentico.Kontent.Statiq.Memoirs.Models { public partial class Post: IPageMetadata { - public string Url => $"post/{PostDate.Value.Year}/{PostDate.Value.Month:00}/{UrlSlug}.html"; + public string Url => $"post/{PostDate?.Year ?? 0}/{(PostDate?.Month??0):00}/{UrlSlug}.html"; } } \ No newline at end of file diff --git a/Pipelines/Pages.cs b/Pipelines/Pages.cs index 8ba9fda..32bc52f 100644 --- a/Pipelines/Pages.cs +++ b/Pipelines/Pages.cs @@ -1,5 +1,5 @@ using Kentico.Kontent.Delivery.Abstractions; -using Kentico.Kontent.Delivery.Urls.QueryParameters; +using Kentico.Kontent.Urls.Delivery.QueryParameters; using Kentico.Kontent.Statiq.Memoirs.Models; using Kontent.Statiq; using MemoirsTheme.Models; @@ -19,8 +19,10 @@ public Pages(IDeliveryClient deliveryClient, SiteSettings site) InputModules = new ModuleList { new Kontent(deliveryClient) - .OrderBy(Post.TitleCodename, SortOrder.Descending) - .WithQuery(new DepthParameter(2), new IncludeTotalCountParameter()), + .WithQuery( + new DepthParameter(2), + new IncludeTotalCountParameter(), + new OrderParameter("elements."+Post.TitleCodename, SortOrder.Descending)), new SetMetadata(nameof(Page.Tags), KontentConfig.Get(post => post.Tags?.ToArray())), new SetMetadata(nameof(Page.Categories), diff --git a/Pipelines/Posts.cs b/Pipelines/Posts.cs index 246de67..af165b8 100644 --- a/Pipelines/Posts.cs +++ b/Pipelines/Posts.cs @@ -1,5 +1,5 @@ using Kentico.Kontent.Delivery.Abstractions; -using Kentico.Kontent.Delivery.Urls.QueryParameters; +using Kentico.Kontent.Urls.Delivery.QueryParameters; using Kentico.Kontent.Statiq.Memoirs.Models; using Kontent.Statiq; using MemoirsTheme.Models; @@ -18,8 +18,10 @@ public Posts(IDeliveryClient deliveryClient, SiteSettings site) Dependencies.Add(nameof(Seo)); InputModules = new ModuleList{ new Kontent(deliveryClient) - .OrderBy(Post.PostDateCodename, SortOrder.Descending) - .WithQuery(new DepthParameter(2), new IncludeTotalCountParameter()), + .WithQuery( + new DepthParameter(2), + new IncludeTotalCountParameter(), + new OrderParameter("elements."+Post.PostDateCodename, SortOrder.Descending)), new SetMetadata(nameof(Post.Tags), KontentConfig.Get(post => post.Tags?.ToArray())), new SetMetadata(nameof(Post.Categories), @@ -66,4 +68,4 @@ public Posts(IDeliveryClient deliveryClient, SiteSettings site) }; } } -} \ No newline at end of file +} diff --git a/Pipelines/Seo.cs b/Pipelines/Seo.cs index 0f11d22..27d44da 100644 --- a/Pipelines/Seo.cs +++ b/Pipelines/Seo.cs @@ -1,5 +1,5 @@ using Kentico.Kontent.Delivery.Abstractions; -using Kentico.Kontent.Delivery.Urls.QueryParameters; +using Kentico.Kontent.Urls.Delivery.QueryParameters; using Kontent.Statiq; using Statiq.Common; using Statiq.Core; diff --git a/Pipelines/Taxonomy.cs b/Pipelines/Taxonomy.cs index 8b3bd2c..5dc2ae5 100644 --- a/Pipelines/Taxonomy.cs +++ b/Pipelines/Taxonomy.cs @@ -1,6 +1,4 @@ -using Kentico.Kontent.Delivery.Abstractions; -using Kentico.Kontent.Statiq.Lumen.Pipelines; -using Kentico.Kontent.Statiq.Memoirs.Models; +using Kentico.Kontent.Statiq.Memoirs.Models; using Kontent.Statiq; using MemoirsTheme.Modules; using Statiq.Common; @@ -71,22 +69,5 @@ public Taxonomy(SiteSettings site) new WriteFiles() }; } - - public class TaxonomyTermComparer : IEqualityComparer - { - public bool Equals(ITaxonomyTerm x, ITaxonomyTerm y) - { - if (ReferenceEquals(x, y)) return true; - if (ReferenceEquals(x, null)) return false; - if (ReferenceEquals(y, null)) return false; - if (x.GetType() != y.GetType()) return false; - return x.Codename == y.Codename; - } - - public int GetHashCode(ITaxonomyTerm obj) - { - return (obj.Codename != null ? obj.Codename.GetHashCode() : 0); - } - } } } diff --git a/input/Shared/_article.cshtml b/input/Shared/_article.cshtml index 6bf54d4..c795458 100644 --- a/input/Shared/_article.cshtml +++ b/input/Shared/_article.cshtml @@ -1,21 +1,21 @@ -@using Kentico.Kontent.Statiq.Memoirs.Models -@model Kentico.Kontent.Statiq.Memoirs.Models.IPageMetadata - -
- +@using Kentico.Kontent.Statiq.Memoirs.Models +@model Kentico.Kontent.Statiq.Memoirs.Models.IPageMetadata + +
+ @if( Model.TableOfContents()){ /*if (Model.beforetoc) {

Model.beforetoc

- }*/ -
-

Summary

- @Html.TableOfContents(Model.Body) -
- } - -
- @Html.Raw(Model.Body) -
+ }*/ +
+

Summary

+ @Html.TableOfContents(Model.Body) +
+ } + +
+ @Html.Raw(Model.Body) +
\ No newline at end of file diff --git a/input/Shared/_featured-image.cshtml b/input/Shared/_featured-image.cshtml index adbd953..0ba5115 100644 --- a/input/Shared/_featured-image.cshtml +++ b/input/Shared/_featured-image.cshtml @@ -1,20 +1,20 @@ -@using Kentico.Kontent.Delivery.Abstractions -@model IEnumerable -@{ - bool lazyImages = Html.Site().LazyImages; +@using Kentico.Kontent.Delivery.Abstractions +@model IEnumerable +@{ + bool lazyImages = Html.Site().LazyImages; bool imageShadow = Html.Site().ImageShadow; - IAsset image = Model?.FirstOrDefault(); -} -@if (image != null) -{ -
- @if (lazyImages) - { - @image.Description - } - else - { - @image.Description - } -
+ IAsset image = Model?.FirstOrDefault(); +} +@if (image != null) +{ +
+ @if (lazyImages) + { + @image.Description + } + else + { + @image.Description + } +
} \ No newline at end of file diff --git a/input/Shared/author-box.cshtml b/input/Shared/author-box.cshtml index 63a32c5..7195e6f 100644 --- a/input/Shared/author-box.cshtml +++ b/input/Shared/author-box.cshtml @@ -1,37 +1,37 @@ -@using Kentico.Kontent.ImageTransformation -@using Kentico.Kontent.Statiq.Memoirs.Models -@using MemoirsTheme.Helpers -@model Kentico.Kontent.Statiq.Memoirs.Models.Author -@{ - var site = ViewData["SiteMetaData"] as SiteSettings; -} - +@using Kentico.Kontent.Urls.ImageTransformation +@using Kentico.Kontent.Statiq.Memoirs.Models +@using MemoirsTheme.Helpers +@model Kentico.Kontent.Statiq.Memoirs.Models.Author +@{ + var site = ViewData["SiteMetaData"] as SiteSettings; +} + @if( Model != null && site.AuthorBox){ -
-
- @if (Model?.AvatarImage != null) - { - @Html.Image(Model.AvatarImage, Model.Name, site.LazyImages, 580, 400, ImageFitMode.Crop, new { @class = "img-thumb" }) - } - else - { - @Model.Name - } -
-
- @foreach (var contact in Model.Contacts.OfType()) - { - @if (contact.Icon == "web") - { - About @Model.Name - } - else - { - - } - } - - @Model.Bio -
-
+
+
+ @if (Model?.AvatarImage != null) + { + @Html.Image(Model.AvatarImage, Model.Name, site.LazyImages, 580, 400, ImageFitMode.Crop, new { @class = "img-thumb" }) + } + else + { + @Model.Name + } +
+
+ @foreach (var contact in Model.Contacts.OfType()) + { + @if (contact.Icon == "web") + { + About @Model.Name + } + else + { + + } + } + + @Model.Bio +
+
} \ No newline at end of file diff --git a/input/Shared/postbox.cshtml b/input/Shared/postbox.cshtml index 28041b4..40a73fa 100644 --- a/input/Shared/postbox.cshtml +++ b/input/Shared/postbox.cshtml @@ -1,4 +1,4 @@ -@using Kentico.Kontent.ImageTransformation +@using Kentico.Kontent.Urls.ImageTransformation @using Kentico.Kontent.Statiq.Memoirs.Models @model Kentico.Kontent.Statiq.Memoirs.Models.Post @{ var site = ViewData["SiteMetadata"] as SiteSettings;