Statiq.Web icon indicating copy to clipboard operation
Statiq.Web copied to clipboard

Generate multiple html from one razor

Open biologist9675 opened this issue 4 years ago • 1 comments

Hi,

I am mostly familiar with MVC and Web Forms. Trying to understand this great framework better and how to compose custom pipelines. I have a giant list of data loaded from the database using ReadDataModule. I want to pass subsets/chunks of this data to the same razor .cshtml and generate multiple html pages. Each html output page will be dynamically named based on some of the input data. I am trying to write a custom pipeline below to pass the chunks to the razor template multiple times, but having trouble understanding how to do this. Any help is appreciated.

public class TestPipeline : Pipeline
{
    public TestPipeline()
    {
        InputModules = new ModuleList
        {
            new ReadFiles("TestTemplate.cshtml")
        };

        ProcessModules = new ModuleList
        {
            new RenderRazor()
        };

        OutputModules = new ModuleList
        {
            new WriteFiles()
        };
    }
}

biologist9675 avatar Dec 10 '20 15:12 biologist9675

Hey there, sorry for the extremely late reply. I'm catching up on the issues I managed to miss over the last year.

Are you still working on this and need help on how to do it, or were you able to figure it out? Let me know and I'll work up an example if you still need one.

daveaglick avatar Mar 10 '22 01:03 daveaglick