Skip to content

How Can I Render the Same Handlebar Template for Multiple Data Models #229

Answered by boblewisvb
mjehle82 asked this question in Q&A
Discussion options

You must be logged in to vote

This is a simplified version of what we are using to develop a static ecommerce site. It uses the following steps.

  1. Create module that generates documents with the required data
  2. Use module in a pipeline to load data
  3. Create pipleline that renders the data into html files

The following should give you enough to create the workflow for your specific situation. Not sure if there is a simpler way, but this is what we have come up with and it is working well.

Simple data model

public class HandlebarData
{
    public string Name { get; set; }
    public string FileName { get; set; }
}

1. Module for creating documents with data

public class DocumentsFromHandlebarData : global::Statiq.Common.Mod…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mjehle82
Comment options

@boblewisvb
Comment options

Answer selected by mjehle82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants