Skip to content

Commit

Permalink
Fix - case sensitive file names for razor views
Browse files Browse the repository at this point in the history
* Failed to generate content for most pipelines on linux
* Added exception to Lunr index module ( issue #2 )
  • Loading branch information
alanta committed Nov 25, 2020
1 parent 3a23d27 commit 5269404
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:

runs-on: windows-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 5 additions & 0 deletions Modules/LunrIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public class LunrIndexer : Module

protected override async Task<IEnumerable<IDocument>> ExecuteContextAsync(IExecutionContext context)
{
if (context.Inputs.Length == 0)
{
throw new InvalidOperationException($"No input documents available. Cannot build a search index for pipeline {context.PipelineName}");
}

var documents = new Dictionary<string,object>();

Index idx = await Index.Build(async builder =>
Expand Down
2 changes: 1 addition & 1 deletion Pipelines/Home.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public Home(SiteSettings site)
new ReplaceDocuments(Dependencies.ToArray()),
new PaginateDocuments(6),
new SetDestination(Config.FromDocument((doc, ctx) => Filename(doc))),
new MergeContent(new ReadFiles(patterns: "Index.cshtml")),
new MergeContent(new ReadFiles(patterns: "index.cshtml")),
new RenderRazor()
.WithViewData("Title", "Home")
.WithViewData("SiteMetaData", site)
Expand Down
11 changes: 1 addition & 10 deletions Pipelines/Pages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Pages(IDeliveryClient deliveryClient, SiteSettings site)

ProcessModules = new ModuleList
{
new MergeContent(new ReadFiles( KontentConfig.Get<Page,string>( ViewForPage))),
new MergeContent(new ReadFiles( "page.cshtml")),
new RenderRazor()
.WithViewData( "SEO", Config.FromDocument((doc, ctx) =>
{
Expand All @@ -62,15 +62,6 @@ public Pages(IDeliveryClient deliveryClient, SiteSettings site)
new WriteFiles(),
};
}

public string ViewForPage(Page page)
{
return page.System.Codename switch
{
"contact" => "Contact.cshtml",
_ => "Page.cshtml"
};
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Pipelines/Posts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Posts(IDeliveryClient deliveryClient, SiteSettings site)
};

ProcessModules = new ModuleList {
new MergeContent(new ReadFiles(patterns: "Post.cshtml") ),
new MergeContent(new ReadFiles(patterns: "post.cshtml") ),
new RenderRazor()
.WithViewData( "SEO", Config.FromDocument((doc, ctx) =>
{
Expand Down

0 comments on commit 5269404

Please sign in to comment.