forked from bradwellsb/statiq-blog-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
31 lines (31 loc) · 1.3 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Linq;
using System.Threading.Tasks;
using Statiq.App;
using Statiq.Common;
using Statiq.Web;
namespace StatiqBlog
{
class Program
{
static async Task<int> Main(string[] args) =>
await Bootstrapper.Factory
.CreateWeb(args)
.AddSetting(Keys.Host, new Uri(Constants.SiteUri).Host)
.AddSetting(Keys.LinksUseHttps, true)
.AddSetting(
Keys.DestinationPath,
Config.FromDocument((doc, ctx) =>
{
// Only applies to the content pipeline
if (ctx.PipelineName == nameof(Statiq.Web.Pipelines.Content))
{
return doc.Source.Parent.Segments.Last().SequenceEqual("posts".AsMemory())
? new NormalizedPath(Constants.BlogPath).Combine(doc.GetDateTime(WebKeys.Published).ToString("yyyy")).Combine(doc.GetString("Category")).Combine(doc.Destination.FileName.ChangeExtension(".html"))
: doc.Destination.ChangeExtension(".html");
}
return doc.Destination;
}))
.RunAsync();
}
}