Skip to content

Commit

Permalink
feat: show posts in the future for Development environments
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkurSheel committed Dec 19, 2021
1 parent 9132ce8 commit 791f100
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/StatiqHelpers/Extensions/ContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ public static string GetGithubUserName(this IExecutionContext context)
=> context.GetString("GithubUsername");

public static string? GetGoogleTagManagerId(this IExecutionContext context)
=> context.GetString("Environment") != "Development"
=> context.IsDevelopment()
? context.GetString("GoogleTagManagerId")
: null;

public static bool IsDevelopment(this IExecutionContext context)
=> context.GetString("Environment") != "Development";

public static string? GetGoatCounterCode(this IExecutionContext context)
=> context.GetString("GoatCounterCode");
}
Expand Down
3 changes: 2 additions & 1 deletion src/StatiqHelpers/Pipelines/PostPipeline.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Polly;
using Statiq.Common;
using Statiq.Core;
using Statiq.Highlight;
Expand Down Expand Up @@ -27,7 +28,7 @@ public PostPipeline(IReadingTimeService readingTimeService)
{
new ExtractFrontMatter(new ParseYaml()),
new GeneratePostDetailsFromPath(),
new FilterDocuments(Config.FromDocument((document) => document.GetPublishedDate() <= DateTime.Today)),
new FilterDocuments(Config.FromDocument((document, context) => !context.IsDevelopment() || document.GetPublishedDate() <= DateTime.Today)),
new GenerateRssMetaData(),
new ReplaceInContent(
@"!\[(?<alt>.*)\]\(./images/(?<imagePath>.*)\)",
Expand Down

0 comments on commit 791f100

Please sign in to comment.