From ce5d408cfcbd282ebc2b5c43279735c63dec929b Mon Sep 17 00:00:00 2001 From: Marnix van Valen Date: Thu, 29 Oct 2020 21:07:21 +0100 Subject: [PATCH] Work in progress : Posts and Assets --- MemoirsTheme.csproj | 1 + MemoirsTheme.sln | 23 ++- Models/ContentTypes/Author.Generated.cs | 29 ++++ Models/ContentTypes/Author.cs | 10 ++ Models/ContentTypes/Contact.Generated.cs | 25 +++ Models/ContentTypes/Contact.cs | 10 ++ Models/ContentTypes/CustomTypeProvider.cs | 2 + Models/ContentTypes/Post.cs | 3 +- Models/IPageMetadata.cs | 23 +++ Models/PostViewModel.cs | 16 ++ Models/SiteSettings.cs | 12 ++ Pipelines/Assets.cs | 17 ++ Pipelines/Authors.cs | 18 +++ Pipelines/DownloadImages.cs | 25 +++ Pipelines/Posts.cs | 60 +++++++ Pipelines/StyleSheets.cs | 8 +- Program.cs | 7 + Resolvers/CodeSnippetResolver.cs | 14 ++ Resolvers/CustomContentLinkUrlResolver.cs | 26 +++ Resolvers/GithubGistResolver.cs | 13 ++ appsettings.json | 10 +- .../article.html => Shared/_article.cshtml} | 4 +- input/Shared/_featured-image.cshtml | 21 +++ input/{_includes => Shared}/author-box.html | 0 input/{_includes => Shared}/comments.html | 0 input/{_includes => Shared}/disqus.html | 0 input/{_includes => Shared}/pagination.html | 0 input/{_includes => Shared}/postbox.html | 0 .../{_includes => Shared}/related-posts.html | 0 input/{_includes => Shared}/search-lunr.html | 0 input/{_includes => Shared}/share.html | 0 input/{_includes => Shared}/star_rating.html | 0 .../star_rating_postbox.html | 0 input/{_includes => Shared}/toc.html | 0 input/_Layout.cshtml | 150 ++++++++++++++++++ input/_ViewStart.cshtml | 3 + input/_includes/adsense-under-header.html | 12 -- input/_includes/featured-image.html | 9 -- input/_layouts/default.html | 143 ----------------- input/_layouts/post.html | 87 ---------- input/{assets/css => _sass}/theme.scss | 4 - input/{_layouts => }/archive.html | 0 input/{_layouts => }/categories.html | 0 input/{_layouts => }/page.html | 0 input/post.cshtml | 81 ++++++++++ input/{_layouts => }/tags.html | 0 46 files changed, 602 insertions(+), 264 deletions(-) create mode 100644 Models/ContentTypes/Author.Generated.cs create mode 100644 Models/ContentTypes/Author.cs create mode 100644 Models/ContentTypes/Contact.Generated.cs create mode 100644 Models/ContentTypes/Contact.cs create mode 100644 Models/IPageMetadata.cs create mode 100644 Models/PostViewModel.cs create mode 100644 Models/SiteSettings.cs create mode 100644 Pipelines/Assets.cs create mode 100644 Pipelines/Authors.cs create mode 100644 Pipelines/DownloadImages.cs create mode 100644 Pipelines/Posts.cs create mode 100644 Resolvers/CodeSnippetResolver.cs create mode 100644 Resolvers/CustomContentLinkUrlResolver.cs create mode 100644 Resolvers/GithubGistResolver.cs rename input/{_includes/article.html => Shared/_article.cshtml} (90%) create mode 100644 input/Shared/_featured-image.cshtml rename input/{_includes => Shared}/author-box.html (100%) rename input/{_includes => Shared}/comments.html (100%) rename input/{_includes => Shared}/disqus.html (100%) rename input/{_includes => Shared}/pagination.html (100%) rename input/{_includes => Shared}/postbox.html (100%) rename input/{_includes => Shared}/related-posts.html (100%) rename input/{_includes => Shared}/search-lunr.html (100%) rename input/{_includes => Shared}/share.html (100%) rename input/{_includes => Shared}/star_rating.html (100%) rename input/{_includes => Shared}/star_rating_postbox.html (100%) rename input/{_includes => Shared}/toc.html (100%) create mode 100644 input/_Layout.cshtml create mode 100644 input/_ViewStart.cshtml delete mode 100644 input/_includes/adsense-under-header.html delete mode 100644 input/_includes/featured-image.html delete mode 100644 input/_layouts/default.html delete mode 100644 input/_layouts/post.html rename input/{assets/css => _sass}/theme.scss (99%) rename input/{_layouts => }/archive.html (100%) rename input/{_layouts => }/categories.html (100%) rename input/{_layouts => }/page.html (100%) create mode 100644 input/post.cshtml rename input/{_layouts => }/tags.html (100%) diff --git a/MemoirsTheme.csproj b/MemoirsTheme.csproj index fe7de00..2d97d4f 100644 --- a/MemoirsTheme.csproj +++ b/MemoirsTheme.csproj @@ -7,6 +7,7 @@ + diff --git a/MemoirsTheme.sln b/MemoirsTheme.sln index bba50e0..70327fe 100644 --- a/MemoirsTheme.sln +++ b/MemoirsTheme.sln @@ -1,8 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MemoirsTheme", "MemoirsTheme.csproj", "{FD3E8728-0F91-418E-8CA4-5F37B44FF70B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -12,7 +14,24 @@ Global Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Debug|x64.Build.0 = Debug|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Debug|x86.Build.0 = Debug|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Release|Any CPU.Build.0 = Release|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Release|x64.ActiveCfg = Release|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Release|x64.Build.0 = Release|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Release|x86.ActiveCfg = Release|Any CPU + {FD3E8728-0F91-418E-8CA4-5F37B44FF70B}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C1636CD0-F1A4-4C64-8E3C-3ABD1A6E922D} + EndGlobalSection EndGlobal diff --git a/Models/ContentTypes/Author.Generated.cs b/Models/ContentTypes/Author.Generated.cs new file mode 100644 index 0000000..ef13222 --- /dev/null +++ b/Models/ContentTypes/Author.Generated.cs @@ -0,0 +1,29 @@ +// This code was generated by a kontent-generators-net tool +// (see https://github.com/Kentico/kontent-generators-net). +// +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. +// For further modifications of the class, create a separate file with the partial class. + +using System; +using System.Collections.Generic; +using Kentico.Kontent.Delivery.Abstractions; + +namespace Kentico.Kontent.Statiq.Memoirs.Models +{ + public partial class Author + { + public const string Codename = "author"; + public const string AvatarImageCodename = "avatar_image"; + public const string BioCodename = "bio"; + public const string ContactsCodename = "contacts"; + public const string EmailCodename = "email"; + public const string NameCodename = "name"; + + public IEnumerable AvatarImage { get; set; } + public string Bio { get; set; } + public IEnumerable Contacts { get; set; } + public string Email { get; set; } + public string Name { get; set; } + public IContentItemSystemAttributes System { get; set; } + } +} \ No newline at end of file diff --git a/Models/ContentTypes/Author.cs b/Models/ContentTypes/Author.cs new file mode 100644 index 0000000..684ae6a --- /dev/null +++ b/Models/ContentTypes/Author.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using Kentico.Kontent.Delivery.Abstractions; + +namespace Kentico.Kontent.Statiq.Memoirs.Models +{ + public partial class Author + { + } +} \ No newline at end of file diff --git a/Models/ContentTypes/Contact.Generated.cs b/Models/ContentTypes/Contact.Generated.cs new file mode 100644 index 0000000..e5b06fb --- /dev/null +++ b/Models/ContentTypes/Contact.Generated.cs @@ -0,0 +1,25 @@ +// This code was generated by a kontent-generators-net tool +// (see https://github.com/Kentico/kontent-generators-net). +// +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. +// For further modifications of the class, create a separate file with the partial class. + +using System; +using System.Collections.Generic; +using Kentico.Kontent.Delivery.Abstractions; + +namespace Kentico.Kontent.Statiq.Memoirs.Models +{ + public partial class Contact + { + public const string Codename = "contact"; + public const string IconCodename = "icon"; + public const string NameCodename = "name"; + public const string UrlCodename = "url"; + + public string Icon { get; set; } + public string Name { get; set; } + public IContentItemSystemAttributes System { get; set; } + public string Url { get; set; } + } +} \ No newline at end of file diff --git a/Models/ContentTypes/Contact.cs b/Models/ContentTypes/Contact.cs new file mode 100644 index 0000000..3f1a62f --- /dev/null +++ b/Models/ContentTypes/Contact.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using Kentico.Kontent.Delivery.Abstractions; + +namespace Kentico.Kontent.Statiq.Memoirs.Models +{ + public partial class Contact + { + } +} \ No newline at end of file diff --git a/Models/ContentTypes/CustomTypeProvider.cs b/Models/ContentTypes/CustomTypeProvider.cs index 5d7cacd..3629c31 100644 --- a/Models/ContentTypes/CustomTypeProvider.cs +++ b/Models/ContentTypes/CustomTypeProvider.cs @@ -9,7 +9,9 @@ public class CustomTypeProvider : ITypeProvider { private static readonly Dictionary _codenames = new Dictionary { + {typeof(Author), "author"}, {typeof(CodeSnippet), "code_snippet"}, + {typeof(Contact), "contact"}, {typeof(Container), "container"}, {typeof(CustomerCase), "customer_case"}, {typeof(GithubGist), "github_gist"}, diff --git a/Models/ContentTypes/Post.cs b/Models/ContentTypes/Post.cs index 812bfcc..43b7b91 100644 --- a/Models/ContentTypes/Post.cs +++ b/Models/ContentTypes/Post.cs @@ -4,7 +4,8 @@ namespace Kentico.Kontent.Statiq.Memoirs.Models { - public partial class Post + public partial class Post: IPageMetadata { + public string Url => $"{PostDate.Value.Year}/{PostDate.Value.Month:00}/{UrlPattern}.html"; } } \ No newline at end of file diff --git a/Models/IPageMetadata.cs b/Models/IPageMetadata.cs new file mode 100644 index 0000000..5b324fe --- /dev/null +++ b/Models/IPageMetadata.cs @@ -0,0 +1,23 @@ +using Kentico.Kontent.Delivery.Abstractions; +using System.Collections.Generic; + +namespace Kentico.Kontent.Statiq.Memoirs.Models +{ + public interface IPageMetadata + { + public string MetadataTwitterCreator { get; } + public string UrlPattern { get; } + public string MetadataMetaKeywords { get; } + public IEnumerable MetadataTwitterImage { get; } + public string MetadataOgTitle { get; } + public IEnumerable MetadataOgImage { get; } + public string MetadataTwitterSite { get; } + public string MetadataMetaDescription { get; } + public string MetadataMetaTitle { get; } + public string MetadataOgDescription { get; } + + public string Title { get; } + public IEnumerable TeaserImage { get; } + public IEnumerable MetadataTwitterCard { get; set; } + } +} \ No newline at end of file diff --git a/Models/PostViewModel.cs b/Models/PostViewModel.cs new file mode 100644 index 0000000..340cb1f --- /dev/null +++ b/Models/PostViewModel.cs @@ -0,0 +1,16 @@ + +namespace Kentico.Kontent.Statiq.Memoirs.Models +{ + public class PostViewModel + { + public PostViewModel(Post post, Author author, SiteSettings metadata) + { + Post = post; + Author = author; + Metadata = metadata; + } + public Post Post { get; } + public Author Author { get; } + public SiteSettings Metadata { get; } + } +} \ No newline at end of file diff --git a/Models/SiteSettings.cs b/Models/SiteSettings.cs new file mode 100644 index 0000000..18572fd --- /dev/null +++ b/Models/SiteSettings.cs @@ -0,0 +1,12 @@ +namespace Kentico.Kontent.Statiq.Memoirs.Models{ + public class SiteSettings{ + public string Name {get; set;} + public string Title {get; set;} + public string Description {get; set;} + public string Logo {get; set;} + public string Favicon {get; set;} + public bool LazyImages { get; set; } + public bool ImageShadow { get; set; } + public string Copyright { get; set; } + } +} \ No newline at end of file diff --git a/Pipelines/Assets.cs b/Pipelines/Assets.cs new file mode 100644 index 0000000..711f482 --- /dev/null +++ b/Pipelines/Assets.cs @@ -0,0 +1,17 @@ +using Statiq.Common; +using Statiq.Core; + +namespace Kentico.Kontent.Statiq.Lumen.Pipelines +{ + public class Assets : Pipeline + { + public Assets() + { + InputModules = new ModuleList + { + new ReadFiles(pattern: "assets/**/*.{*,!scss}"), + new WriteFiles() + }; + } + } +} \ No newline at end of file diff --git a/Pipelines/Authors.cs b/Pipelines/Authors.cs new file mode 100644 index 0000000..f7ca173 --- /dev/null +++ b/Pipelines/Authors.cs @@ -0,0 +1,18 @@ +using Kentico.Kontent.Delivery.Abstractions; +using Kentico.Kontent.Statiq.Memoirs.Models; +using Kontent.Statiq; +using Statiq.Common; +using Statiq.Core; + +namespace Kentico.Kontent.Statiq.Lumen.Pipelines +{ + public class Authors : Pipeline + { + public Authors(IDeliveryClient deliveryClient) + { + InputModules = new ModuleList{ + new Kontent(deliveryClient) + }; + } + } +} \ No newline at end of file diff --git a/Pipelines/DownloadImages.cs b/Pipelines/DownloadImages.cs new file mode 100644 index 0000000..02b0cd4 --- /dev/null +++ b/Pipelines/DownloadImages.cs @@ -0,0 +1,25 @@ +using Kentico.Kontent.Statiq.Lumen.Pipelines; +using Kontent.Statiq; +using Statiq.Common; +using Statiq.Core; +using System.Linq; + +namespace MemoirsTheme.Pipelines +{ + public class DownloadImages : Pipeline + { + public DownloadImages() + { + Dependencies.AddRange(nameof(Posts)); + PostProcessModules = new ModuleList( + // pull documents from other pipelines + new ReplaceDocuments(Dependencies.ToArray()), + new KontentDownloadImages() + ); + OutputModules = new ModuleList( + + new WriteFiles() + ); + } + } +} \ No newline at end of file diff --git a/Pipelines/Posts.cs b/Pipelines/Posts.cs new file mode 100644 index 0000000..e0144d5 --- /dev/null +++ b/Pipelines/Posts.cs @@ -0,0 +1,60 @@ +using Kentico.Kontent.Delivery.Abstractions; +using Kentico.Kontent.Delivery.Urls.QueryParameters; +using Kentico.Kontent.Statiq.Memoirs.Models; +using Kontent.Statiq; +using Statiq.Common; +using Statiq.Core; +using Statiq.Razor; +using System.Linq; + +namespace Kentico.Kontent.Statiq.Lumen.Pipelines +{ + public class Posts : Pipeline + { + public Posts(IDeliveryClient deliveryClient, SiteSettings site) + { + Dependencies.AddRange(nameof(Authors)); + InputModules = new ModuleList{ + new Kontent(deliveryClient) + .OrderBy(Post.PostDateCodename, SortOrder.Descending) + .WithQuery(new DepthParameter(1), new IncludeTotalCountParameter()), + /*new SetMetadata(nameof(Category), Config.FromDocument((doc, ctx) => + { + // Add category (useful for grouping) + return doc.AsKontent
().SelectedCategory.System.Codename; + })), + new SetMetadata(nameof(Article.SelectedCategory), Config.FromDocument((doc, ctx) => + { + // Add some extra metadata to be used later for creating filenames + return doc.AsKontent
().SelectedCategory; + })), + new SetMetadata(nameof(Tag), Config.FromDocument((doc, ctx) => + { + // Add tag (useful for grouping) + return doc.AsKontent
().TagObjects.Select(t=>t.System.Codename); + })), + new SetMetadata(nameof(Article.TagObjects), Config.FromDocument((doc, ctx) => + { + // Add some extra metadata to be used later for creating filenames + return doc.AsKontent
().TagObjects; + })),*/ + new SetDestination(Config.FromDocument((doc, ctx) => new NormalizedPath($"posts/{doc.AsKontent().Url}" ))), + }; + + ProcessModules = new ModuleList { + new MergeContent(new ReadFiles(patterns: "Post.cshtml") ), + new RenderRazor() + .WithModel(Config.FromDocument((document, context) => + new PostViewModel(document.AsKontent(), + context.Outputs.FromPipeline(nameof(Authors)).Select(x => x.AsKontent()).FirstOrDefault(), + site + ))), + new KontentImageProcessor() + }; + + OutputModules = new ModuleList { + new WriteFiles(), + }; + } + } +} \ No newline at end of file diff --git a/Pipelines/StyleSheets.cs b/Pipelines/StyleSheets.cs index e0177ed..ead9877 100644 --- a/Pipelines/StyleSheets.cs +++ b/Pipelines/StyleSheets.cs @@ -8,11 +8,13 @@ public class StyleSheets : Pipeline { public StyleSheets() { - InputModules = new ModuleList { - new ReadFiles(pattern: "_sass/**/{!_,}*.scss"), + InputModules = new ModuleList + { + new ReadFiles("_sass/**/{!_,}*.scss"), new CompileSass() .WithCompactOutputStyle(), - new SetDestination(".css"), + new SetDestination(Config.FromDocument((doc, ctx) => + new NormalizedPath($"assets/css/{doc.Source.FileNameWithoutExtension}.css"))), new WriteFiles() }; } diff --git a/Program.cs b/Program.cs index d23ac32..e8273ff 100644 --- a/Program.cs +++ b/Program.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Configuration; using Statiq.Web; using Kentico.Kontent.Statiq.Memoirs.Models; +using MemoirsTheme.Resolvers; namespace MemoirsTheme { @@ -18,7 +19,13 @@ await Bootstrapper .CreateDefault(args) .ConfigureServices((services, settings) => { + // pull in site settings from configuration + var siteSettings = (settings as IConfiguration).GetSection("Site").Get(); + services.AddSingleton(siteSettings); + services.AddSingleton(); + services.AddDeliveryInlineContentItemsResolver(new CodeSnippetResolver()); + services.AddDeliveryInlineContentItemsResolver(new GitHubGistResolver()); services.AddDeliveryClient((IConfiguration)settings); }) .AddHostingCommands() diff --git a/Resolvers/CodeSnippetResolver.cs b/Resolvers/CodeSnippetResolver.cs new file mode 100644 index 0000000..35b1139 --- /dev/null +++ b/Resolvers/CodeSnippetResolver.cs @@ -0,0 +1,14 @@ +using Kentico.Kontent.Delivery.Abstractions; +using Kentico.Kontent.Statiq.Memoirs.Models; +using System.Linq; + +namespace MemoirsTheme.Resolvers +{ + public class CodeSnippetResolver : IInlineContentItemsResolver + { + public string Resolve(CodeSnippet data) + { + return $"
{data.Code}
"; + } + } +} \ No newline at end of file diff --git a/Resolvers/CustomContentLinkUrlResolver.cs b/Resolvers/CustomContentLinkUrlResolver.cs new file mode 100644 index 0000000..6ebefdd --- /dev/null +++ b/Resolvers/CustomContentLinkUrlResolver.cs @@ -0,0 +1,26 @@ +using Kentico.Kontent.Delivery.Abstractions; +using System.Threading.Tasks; + +namespace MemoirsTheme.Resolvers +{ + public class CustomContentLinkUrlResolver : IContentLinkUrlResolver + { + public Task ResolveLinkUrlAsync(IContentLink link) + { + // Resolves URLs to content items based on the 'accessory' content type + var result = link.ContentTypeCodename switch + { + "post" => $"{link.UrlSlug}", + _ => "/404", + }; + + return Task.FromResult(result); + } + + public Task ResolveBrokenLinkUrlAsync() + { + // Resolves URLs to unavailable content items + return Task.FromResult("/404"); + } + } +} \ No newline at end of file diff --git a/Resolvers/GithubGistResolver.cs b/Resolvers/GithubGistResolver.cs new file mode 100644 index 0000000..0301cc5 --- /dev/null +++ b/Resolvers/GithubGistResolver.cs @@ -0,0 +1,13 @@ +using Kentico.Kontent.Delivery.Abstractions; +using Kentico.Kontent.Statiq.Memoirs.Models; + +namespace MemoirsTheme.Resolvers +{ + public class GitHubGistResolver : IInlineContentItemsResolver + { + public string Resolve(GithubGist data) + { + return $""; + } + } +} \ No newline at end of file diff --git a/appsettings.json b/appsettings.json index 1ec2aae..eaed3e9 100644 --- a/appsettings.json +++ b/appsettings.json @@ -4,5 +4,13 @@ }, "LinkHideExtensions": "true", "Host": "", - "LinksUseHttps": true + "LinksUseHttps": true, + "Site": { + "Name": "Memoirs", + "Title": "Memoirs", + "description": "I will take you on the fabulous world of exploration. Travel, culture, lifestyle. Eat, Pray, Love!", + "Logo": "assets/images/logo.png", + "Favicon": "assets/images/logo.png", + "Copyright": "Memoirs" + } } \ No newline at end of file diff --git a/input/_includes/article.html b/input/Shared/_article.cshtml similarity index 90% rename from input/_includes/article.html rename to input/Shared/_article.cshtml index 504e147..ae54a7b 100644 --- a/input/_includes/article.html +++ b/input/Shared/_article.cshtml @@ -2,7 +2,7 @@ ================================================== -->
- {% if page.toc %} + @*{% if page.toc %} {% if page.beforetoc %}

{{page.beforetoc}}

{% endif %} @@ -10,7 +10,7 @@

Summary

{% include toc.html html=content %}
- {% endif %} + {% endif %}*@ {{content}} \ No newline at end of file diff --git a/input/Shared/_featured-image.cshtml b/input/Shared/_featured-image.cshtml new file mode 100644 index 0000000..05395be --- /dev/null +++ b/input/Shared/_featured-image.cshtml @@ -0,0 +1,21 @@ +@using Kentico.Kontent.Delivery.Abstractions +@using Kentico.Kontent.Statiq.Memoirs.Models +@model IEnumerable +@{ + bool lazyImages = (ViewBag.SiteSettings as SiteSettings)?.LazyImages ?? false; + bool imageShadow = (ViewBag.SiteSettings as SiteSettings)?.ImageShadow ?? false; + IAsset image = Model.FirstOrDefault(); +} +@if (image != null) +{ +
+ @if (lazyImages) + { + @image.Description + } + else + { + @image.Description + } +
+} \ No newline at end of file diff --git a/input/_includes/author-box.html b/input/Shared/author-box.html similarity index 100% rename from input/_includes/author-box.html rename to input/Shared/author-box.html diff --git a/input/_includes/comments.html b/input/Shared/comments.html similarity index 100% rename from input/_includes/comments.html rename to input/Shared/comments.html diff --git a/input/_includes/disqus.html b/input/Shared/disqus.html similarity index 100% rename from input/_includes/disqus.html rename to input/Shared/disqus.html diff --git a/input/_includes/pagination.html b/input/Shared/pagination.html similarity index 100% rename from input/_includes/pagination.html rename to input/Shared/pagination.html diff --git a/input/_includes/postbox.html b/input/Shared/postbox.html similarity index 100% rename from input/_includes/postbox.html rename to input/Shared/postbox.html diff --git a/input/_includes/related-posts.html b/input/Shared/related-posts.html similarity index 100% rename from input/_includes/related-posts.html rename to input/Shared/related-posts.html diff --git a/input/_includes/search-lunr.html b/input/Shared/search-lunr.html similarity index 100% rename from input/_includes/search-lunr.html rename to input/Shared/search-lunr.html diff --git a/input/_includes/share.html b/input/Shared/share.html similarity index 100% rename from input/_includes/share.html rename to input/Shared/share.html diff --git a/input/_includes/star_rating.html b/input/Shared/star_rating.html similarity index 100% rename from input/_includes/star_rating.html rename to input/Shared/star_rating.html diff --git a/input/_includes/star_rating_postbox.html b/input/Shared/star_rating_postbox.html similarity index 100% rename from input/_includes/star_rating_postbox.html rename to input/Shared/star_rating_postbox.html diff --git a/input/_includes/toc.html b/input/Shared/toc.html similarity index 100% rename from input/_includes/toc.html rename to input/Shared/toc.html diff --git a/input/_Layout.cshtml b/input/_Layout.cshtml new file mode 100644 index 0000000..7766a3c --- /dev/null +++ b/input/_Layout.cshtml @@ -0,0 +1,150 @@ +@using Kentico.Kontent.Statiq.Memoirs.Models +@using Statiq.Common +@{ var site = ViewBag.SiteMetadata as SiteSettings; +var author = ViewBag.Author as Author; +var name = author?.Name ?? "John Doe"; +var isHome = false; +} + + + + + + + + + @ViewBag.Title | @site.Name + + @RenderSection("seo", required: false) + + + + + + + + + +@*{% if jekyll.environment == 'production' %} + + + {% endif %}*@ + +@*{% capture layout %}{% if page.layout %}layout-{{ page.layout }}{% endif %}{% endcapture %}*@ + + + + + + + + +
+ + + @*{% include search-lunr.html %}*@ + + + + +
+ +
+ + + + + @site.Name + + + + + @if( isHome ){ +

+ @site.Description +

+ } + + +
+ @RenderBody() +
+ + @*{% if site.mailchimp-list %} + + + {% endif %}*@ + +
+ + +
+
+
+
+ Copyright © @DateTime.Today.Year @site.Copyright +
+
+ Memoirs Jekyll Theme by WowThemes.net +
+
+
+
+ + +
+ + + + + + + @if (site.LazyImages) + { + + } + + @if (ViewBag.Layout == "post") + { +} + + + diff --git a/input/_ViewStart.cshtml b/input/_ViewStart.cshtml new file mode 100644 index 0000000..056fef5 --- /dev/null +++ b/input/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} \ No newline at end of file diff --git a/input/_includes/adsense-under-header.html b/input/_includes/adsense-under-header.html deleted file mode 100644 index ee815ba..0000000 --- a/input/_includes/adsense-under-header.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - -
\ No newline at end of file diff --git a/input/_includes/featured-image.html b/input/_includes/featured-image.html deleted file mode 100644 index 85d6d9e..0000000 --- a/input/_includes/featured-image.html +++ /dev/null @@ -1,9 +0,0 @@ -{% if page.image %} -
- {% if site.lazyimages == "enabled" %} - {{ page.title }} - {% else %} - {{ page.title }} - {% endif %} -
-{% endif %} \ No newline at end of file diff --git a/input/_layouts/default.html b/input/_layouts/default.html deleted file mode 100644 index dc63bfd..0000000 --- a/input/_layouts/default.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - -{{ page.title }} | {{site.name}} - -{% seo %} - - - - - - - - - -{% if jekyll.environment == 'production' %} - - -{% endif %} - -{% capture layout %}{% if page.layout %}layout-{{ page.layout }}{% endif %}{% endcapture %} - - - - - - - - -
- - -{% include search-lunr.html %} - - - - -
- -
- - - - - {{ site.name }} - - - - - {% if page.url == '/' %} -

- {{ site.description }} -

- {% endif %} - - -
- {{ content }} -
- - {% if site.mailchimp-list %} - - - {% endif %} - -
- - -
-
-
-
- Copyright © {{ site.time | date: "%Y" }} {{ site.name }} -
-
- Memoirs Jekyll Theme by WowThemes.net -
-
-
-
- - -
- - - - - - - -{% if site.lazyimages == "enabled" %} - -{% endif %} - -{% if page.layout == 'post' %} - -{% endif %} - - - diff --git a/input/_layouts/post.html b/input/_layouts/post.html deleted file mode 100644 index f3392a4..0000000 --- a/input/_layouts/post.html +++ /dev/null @@ -1,87 +0,0 @@ ---- -layout: default -disqus: false -archive: false -post_class: post-template ---- - -
- -

{{ page.title }}

- - {% assign author = site.authors[page.author] %} - {% if page.author %} -
-
- {% if author.avatar %} - {{ author.display_name }} - {% else %} - {{ author.display_name }} - {% endif %} -
-
- Written by {{ author.display_name }} on - - {% if page.last_modified_at %} - (Updated: ) - {% endif %} -
-
- {% endif %} -
- - -{% if site.adsense == "enabled" %} - {% include adsense-under-header.html %} -{% endif %} - - -{% include featured-image.html %} - - -{% include article.html %} - - -{% if page.rating %} -
- Rating: {% include star_rating.html %} -
-{% endif %} - - -{% include author-box.html %} - - -{% include comments.html %} - - -{% include share.html %} - - -{% include related-posts.html %} - - -{% if page.rating %} - -{% endif %} \ No newline at end of file diff --git a/input/assets/css/theme.scss b/input/_sass/theme.scss similarity index 99% rename from input/assets/css/theme.scss rename to input/_sass/theme.scss index 75a10e6..40f9a3b 100644 --- a/input/assets/css/theme.scss +++ b/input/_sass/theme.scss @@ -1,7 +1,3 @@ ---- - ---- - $brown: #B59F62; $teal: #40FFDC; $black: #111; diff --git a/input/_layouts/archive.html b/input/archive.html similarity index 100% rename from input/_layouts/archive.html rename to input/archive.html diff --git a/input/_layouts/categories.html b/input/categories.html similarity index 100% rename from input/_layouts/categories.html rename to input/categories.html diff --git a/input/_layouts/page.html b/input/page.html similarity index 100% rename from input/_layouts/page.html rename to input/page.html diff --git a/input/post.cshtml b/input/post.cshtml new file mode 100644 index 0000000..298fb50 --- /dev/null +++ b/input/post.cshtml @@ -0,0 +1,81 @@ +@using Kentico.Kontent.Statiq.Memoirs.Models +@using Statiq.Common +@model Kentico.Kontent.Statiq.Memoirs.Models.PostViewModel +@{ ViewData["SiteMetadata"] = Model.Metadata; + ViewData["Author"] = Model.Author; + var article = Model.Post; } +
+ +

@Model.Post.Title

+ + @if (Model.Author != null) + { +
+
+ @if (Model.Author.AvatarImage?.Any() ?? false) + { +@Model.Author.Name } + else + { +{{ author.display_name }}} +
+
+ Written by @Model.Author.Name on + +
+
} +
+ + +@{ await Html.RenderPartialAsync("_featured-image", @Model.Post.TeaserImage); } + + +@* {% include article.html %} *@ +
+ @Html.Raw(Model.Post.Body) +
+ + +{% if page.rating %} +
+ Rating: {% include star_rating.html %} +
+{% endif %} + + +{% include author-box.html %} + + +{% include comments.html %} + + +{% include share.html %} + + +{% include related-posts.html %} + + +@*{% if page.rating %} + +{% endif %}*@ \ No newline at end of file diff --git a/input/_layouts/tags.html b/input/tags.html similarity index 100% rename from input/_layouts/tags.html rename to input/tags.html