mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-18 21:08:15 +08:00
Add blog to docs (#484)
* Adding social card infrastructure * Upgrades doc project to .NET 6 * Adds Playwright * Changes the console to a web project for Playwright * Adds social card template * Added blog content * Parallelized social image processing * Updating CI to use .NET 6 for docs build
This commit is contained in:
15
docs/input/blog/_category.yaml
Normal file
15
docs/input/blog/_category.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
ArchiveSources: => $"blog/posts/**/*"
|
||||
ArchiveKey: Category
|
||||
ArchiveKeyComparer: => StringComparer.OrdinalIgnoreCase.ToConvertingEqualityComparer()
|
||||
ArchiveDestination: >
|
||||
=> GetInt("Index") <= 1 ? $"blog/{NormalizedPath.OptimizeFileName(GetString("GroupKey"))}/index.html" : $"blog/{NormalizedPath.OptimizeFileName(GetString("GroupKey"))}/{GetInt("Index")}.html"
|
||||
ArchivePageSize: => 5
|
||||
ArchiveOrderKey: published
|
||||
ArchiveOrderDescending: true
|
||||
Title: Categories
|
||||
ArchiveTitle: => GetString("GroupKey")
|
||||
# we only show if we have a group key which means we are a category and not the index and also
|
||||
# if we are the first page
|
||||
Hidden: >
|
||||
=> doc.GetString("GroupKey") != null && doc.GetInt("Index") <= 1 ? false : true
|
||||
Order: 250
|
2
docs/input/blog/_directory.yaml
Normal file
2
docs/input/blog/_directory.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
Hidden: true
|
||||
Order: 1000
|
10
docs/input/blog/_index.yaml
Normal file
10
docs/input/blog/_index.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
Title: Recent Blog Posts
|
||||
ArchiveSources: => $"blog/posts/**/*"
|
||||
ArchiveDestination: >
|
||||
=> GetInt("Index") <= 1 ? $"blog/index.html" : $"blog/{GetInt("Index")}.html"
|
||||
ArchivePageSize: => 5
|
||||
ArchiveOrderKey: Published
|
||||
ArchiveOrderDescending: true
|
||||
Hidden: >
|
||||
=> doc.GetInt("Index") == 1 ? false : true
|
||||
Order: 25
|
27
docs/input/blog/_nextprevious.cshtml
Normal file
27
docs/input/blog/_nextprevious.cshtml
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
@inherits StatiqRazorPage<IDocument>
|
||||
@model IDocument
|
||||
|
||||
@{
|
||||
var older = Model.GetDocument(Keys.Next);
|
||||
var newer = Model.GetDocument(Keys.Previous);
|
||||
}
|
||||
|
||||
|
||||
@if (older != null || newer != null)
|
||||
{
|
||||
<div class="flex flex-row justify-content-between">
|
||||
<div>
|
||||
@if (older != null)
|
||||
{
|
||||
<a class="py-0.5 px-1 mr-4 text-blue-900 bg-grey-50 border border-blue-200 hover:bg-grey-100 hover:text-blue-800 hover:border-blue-300 rounded transition-colors" href="@Context.GetLink(older)" role="button">Older</a>
|
||||
}
|
||||
</div>
|
||||
<div>
|
||||
@if (newer != null)
|
||||
{
|
||||
<a class="py-0.5 px-1 mr-4 text-blue-900 bg-grey-50 border border-blue-200 hover:bg-grey-100 hover:text-blue-800 hover:border-blue-300 rounded transition-colors" href="@Context.GetLink(newer)" role="button">Newer</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
33
docs/input/blog/_posts.cshtml
Normal file
33
docs/input/blog/_posts.cshtml
Normal file
@ -0,0 +1,33 @@
|
||||
@inherits StatiqRazorPage<IEnumerable<IDocument>>
|
||||
@foreach (var post in Model)
|
||||
{
|
||||
<div>
|
||||
<h3 class="mb-0"><a href="@Context.GetLink(post)">@post.GetString("Title")</a></h3>
|
||||
@{
|
||||
var author = post.GetString("Author");
|
||||
var published = post.GetDateTime("Published");
|
||||
var category = post.GetString("Category");
|
||||
}
|
||||
<div class="mt-2 font-light text-xs md:text-sm">
|
||||
<span>Posted </span>
|
||||
@if (published != default(DateTime)) {
|
||||
<span>@published.ToLongDateString() </span>
|
||||
}
|
||||
@if (author != null) {
|
||||
<span>by @author </span>
|
||||
}
|
||||
@if (category != null) {
|
||||
var categoryUrl = @Context.GetLink($"blog/{NormalizedPath.OptimizeFileName(category)}/index.html");
|
||||
<span>
|
||||
to <a class="text-blue-800 underline" href="@categoryUrl">
|
||||
@category
|
||||
</a>
|
||||
</span>
|
||||
}
|
||||
|
||||
</div>
|
||||
<article>
|
||||
@Html.Raw(@post.GetString("Excerpt"))
|
||||
</article>
|
||||
</div>
|
||||
}
|
14
docs/input/blog/category.cshtml
Normal file
14
docs/input/blog/category.cshtml
Normal file
@ -0,0 +1,14 @@
|
||||
@inherits StatiqRazorPage<IDocument>
|
||||
@if (Document.ContainsKey(Keys.GroupKey))
|
||||
{
|
||||
@Html.Partial("_posts.cshtml", Document.GetChildren())
|
||||
@Html.Partial("_nextprevious.cshtml", Document)
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var tag in Document.GetChildren().OrderByDescending(x => x.GetChildren().Count()))
|
||||
{
|
||||
var postCount = tag.GetChildren().Count().ToString();
|
||||
<a role="button" href="@Context.GetLink(tag)" class="badge badge-light"> @tag.GetTitle() (@postCount)</a>
|
||||
}
|
||||
}
|
3
docs/input/blog/index.cshtml
Normal file
3
docs/input/blog/index.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@inherits StatiqRazorPage<IDocument>
|
||||
@Html.Partial("_posts.cshtml", Document.GetChildren())
|
||||
@Html.Partial("_nextprevious.cshtml", Document)
|
9
docs/input/blog/posts/2021-07-11-hello-world.md
Normal file
9
docs/input/blog/posts/2021-07-11-hello-world.md
Normal file
@ -0,0 +1,9 @@
|
||||
Title: Hello, World
|
||||
Description: To help track new releases, updates and planning for Spectre.Console, we've added a new blog to the documentation.
|
||||
Published: 20210711
|
||||
Category: News
|
||||
---
|
||||
|
||||
To help track new releases, updates and planning for Spectre.Console, we've added a new blog to the documentation.
|
||||
|
||||
Stay tuned for upcoming information related to the 0.41 release!
|
19
docs/input/blog/posts/BLOG_TEMPLATE.md
Normal file
19
docs/input/blog/posts/BLOG_TEMPLATE.md
Normal file
@ -0,0 +1,19 @@
|
||||
Title: Short title, less than 50 characters
|
||||
Description: Longer description, with optional *bold* and **italic** characters. Shouldn't be TOO long but can span multiple lines.
|
||||
Published: 20210710
|
||||
Category: Release Notes | News | or whatever
|
||||
Excluded: true
|
||||
---
|
||||
|
||||
Intro paragraph, maybe even just the description. No need for a title that's included automatically.
|
||||
|
||||
## Use second level headers
|
||||
|
||||
Main title will be set with h1
|
||||
|
||||
## Tasks
|
||||
|
||||
1. Set title and description
|
||||
2. Set proper publish date
|
||||
3. Set proper category
|
||||
4. Remove excluded attribute.
|
3
docs/input/blog/posts/_ViewStart.cshtml
Normal file
3
docs/input/blog/posts/_ViewStart.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = @$"_layout.cshtml";
|
||||
}
|
34
docs/input/blog/posts/_layout.cshtml
Normal file
34
docs/input/blog/posts/_layout.cshtml
Normal file
@ -0,0 +1,34 @@
|
||||
@{
|
||||
Layout = @"../../_layout.cshtml";
|
||||
}
|
||||
@inherits StatiqRazorPage<IDocument>
|
||||
|
||||
@{
|
||||
var author = Model.GetString("Author");
|
||||
var published = Model.GetDateTime("Published");
|
||||
var category = Model.GetString("Category");
|
||||
}
|
||||
|
||||
@section subheading{
|
||||
<div class="mt-2 font-light text-xs md:text-sm">
|
||||
<span>Posted </span>
|
||||
@if (published != default(DateTime)) {
|
||||
<span>@published.ToLongDateString() </span>
|
||||
}
|
||||
@if (author != null) {
|
||||
<span>by @author </span>
|
||||
}
|
||||
@if (category != null) {
|
||||
<span>
|
||||
to <a class="text-blue-800 underline" href="@Context.GetLink($"blog/{NormalizedPath.OptimizeFileName(@category)}/index.html")">
|
||||
@category
|
||||
</a>
|
||||
</span>
|
||||
}
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RenderBody()
|
Reference in New Issue
Block a user