Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<PackageVersion Include="Markdig" Version="0.44.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="10.0.0" />
<PackageVersion Include="NCronJob" Version="4.7.0" />
<PackageVersion Include="LinkDotNet.BuildInformation" Version="2.0.0" />
<PackageVersion Include="ReverseMarkdown" Version="4.7.1" />
<PackageVersion Include="System.ServiceModel.Syndication" Version="10.0.0" />
<PackageVersion Include="NetEscapades.AspNetCore.SecurityHeaders" Version="1.3.0" />
Expand Down
10 changes: 10 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Migration Guide
This document describes the changes that need to be made to migrate from one version of the blog to another.

## 11.0 to 12.0
`ShowBuildInformation` setting was added on the root level of the `appsettings.json` file. This setting controls whether build information (like build date) is shown in the `Footer` component.

```json
{
...
"ShowBuildInformation": true
}
```

## 9.0 to 11.0

A new config has been added `UseMultiAuthorMode` in `appsettings.json`. The default value of this config is `false`. If set to `true` then author name will be associated with blog posts at the time of creation.
Expand Down
2 changes: 2 additions & 0 deletions docs/Setup/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The appsettings.json file has a lot of options to customize the content of the b
},
"ShowReadingIndicator": true,
"SimlarBlogPosts": "true",
"ShowBuildInformation": true,
"SupportMe": {
"KofiToken": "ABC123",
"GithubSponsorName": "your-tag-here",
Expand Down Expand Up @@ -102,6 +103,7 @@ The appsettings.json file has a lot of options to customize the content of the b
| [Disqus](./../Comments/Disqus.md) | node | Enables the comment section via disqus. If left empty the comment section will not be shown. |
| ShowReadingIndicator | boolean | If set to `true` (default) a circle indicates the progress when a user reads a blog post (without comments). |
| SimilarBlogPosts | boolean | If set to `true` (default) similar blog posts are shown at the end of a blog post. |
| ShowBuildInformation | boolean | If set to `true` (default) the build information (target framework and build timestamp) is shown in the footer. |
| [SupportMe](./../Donations/Readme.md) | node | Donation sections configuration. If left empty no donation sections will not be shown. |
| [ImageStorageProvider](./../Media/Readme.md) | string | Declares the type of the image storage provider (currently only `Azure`). |
| [ImageStorage](./../Media/Readme.md) | node | Configuration for the image storage provider. |
Expand Down
2 changes: 2 additions & 0 deletions src/LinkDotNet.Blog.Web/ApplicationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ public sealed record ApplicationConfiguration

public bool ShowSimilarPosts { get; init; }

public bool ShowBuildInformation { get; init; } = true;

public bool UseMultiAuthorMode { get; init; }
}
13 changes: 10 additions & 3 deletions src/LinkDotNet.Blog.Web/Features/Home/Components/Footer.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
@inject IOptions<ProfileInformation> ProfileInformation
@inject IOptions<SupportMeConfiguration> SupportConfiguration

<footer class="position-absolute bottom-0 w-100 text-center" style="height: 2.5rem;">
<span class="py-2 mb-0 text-body-secondary">© @DateTime.Now.Year @CopyrightName</span>
<footer class="position-absolute bottom-0 w-100 text-center text-body-secondary" style="height: 2.5rem;">
<span>© @DateTime.Now.Year @CopyrightName</span>
@if (AppConfiguration.Value.ShowBuildInformation)
{
<p class="text-gray-300 mb-0">Made with ❤️, @BuildInformation.TargetFrameworkMoniker, and Blazor</p>
<p class="text-gray-300">
Built At: @(BuildInformation.BuildAt.ToString("dd-MM-yyyy HH:mm")) (UTC)
</p>
}
@if (SupportConfiguration.Value.ShowInFooter)
{
<div class="pb-2 d-flex justify-content-center">
<DonationSection />
<DonationSection/>
</div>
}
</footer>
Expand Down
1 change: 1 addition & 0 deletions src/LinkDotNet.Blog.Web/LinkDotNet.Blog.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<PackageReference Include="Blazored.Toast"/>
<PackageReference Include="Blazorise.Bootstrap5"/>
<PackageReference Include="Blazorise.Markdown"/>
<PackageReference Include="LinkDotNet.BuildInformation"/>
<PackageReference Include="NCronJob"/>
<PackageReference Include="Markdig"/>
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect"/>
Expand Down
1 change: 1 addition & 0 deletions src/LinkDotNet.Blog.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@
},
"ShowReadingIndicator": true,
"ShowSimilarPosts": true,
"ShowBuildInformation": true,
"UseMultiAuthorMode": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class ApplicationConfigurationBuilder
private bool isDisqusEnabled;
private bool showReadingIndicator;
private bool showSimilarPosts;
private bool showBuildInformation = true;
private string? blogBrandUrl;
private bool useMultiAuthorMode;

Expand Down Expand Up @@ -76,6 +77,12 @@ public ApplicationConfigurationBuilder WithShowSimilarPosts(bool showSimilarPost
this.showSimilarPosts = showSimilarPosts;
return this;
}

public ApplicationConfigurationBuilder WithShowBuildInformation(bool showBuildInformation)
{
this.showBuildInformation = showBuildInformation;
return this;
}

public ApplicationConfigurationBuilder WithBlogBrandUrl(string? blogBrandUrl)
{
Expand Down Expand Up @@ -103,6 +110,7 @@ public ApplicationConfiguration Build()
IsDisqusEnabled = isDisqusEnabled,
ShowReadingIndicator = showReadingIndicator,
ShowSimilarPosts = showSimilarPosts,
ShowBuildInformation = showBuildInformation,
BlogBrandUrl = blogBrandUrl,
UseMultiAuthorMode = useMultiAuthorMode,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void ShouldMapFromAppConfiguration()
{ "Giscus:CategoryId", "generalid" },
{ "Disqus:Shortname", "blog" },
{ "ShowReadingIndicator", "true" },
{ "ShowBuildInformation", "true" },
{ "SupportMe:KofiToken", "ABC" },
{ "SupportMe:PatreonName", "linkdotnet" },
{ "SupportMe:GithubSponsorName", "linkdotnet" },
Expand Down Expand Up @@ -65,6 +66,7 @@ public void ShouldMapFromAppConfiguration()
appConfiguration.BlogPostsPerPage.ShouldBe(5);
appConfiguration.IsAboutMeEnabled.ShouldBeTrue();
appConfiguration.ShowReadingIndicator.ShouldBeTrue();
appConfiguration.ShowBuildInformation.ShouldBeTrue();
appConfiguration.UseMultiAuthorMode.ShouldBeTrue();

var giscusConfiguration = new GiscusConfigurationBuilder().Build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,31 @@ public void ShouldNotSetNameIfAboutMeIsNotEnabled()

cut.Find("span").TextContent.ShouldContain("©");
}

[Fact]
public void ShouldShowBuildInformationWhenEnabled()
{
var appConfig = Options.Create(new ApplicationConfigurationBuilder()
.WithShowBuildInformation(true)
.Build());
Services.AddScoped(_ => appConfig);

var cut = Render<Footer>();

cut.Markup.ShouldContain("Built At:");
cut.Markup.ShouldContain("Blazor");
}

[Fact]
public void ShouldNotShowBuildInformationWhenDisabled()
{
var appConfig = Options.Create(new ApplicationConfigurationBuilder()
.WithShowBuildInformation(false)
.Build());
Services.AddScoped(_ => appConfig);

var cut = Render<Footer>();

cut.Markup.ShouldNotContain("Built At:");
}
}