builder icon indicating copy to clipboard operation
builder copied to clipboard

Not being able to use different templates for different models in builder.io

Open shehan-mark opened this issue 2 years ago • 0 comments

Describe the bug Not being able to use different templates for different models in builder.io I have below gatsby-config.js

const path = require('path');
const config = require('./src/config');
module.exports = {
  pathPrefix: "/gatsby-starter-builder",
  siteMetadata: {
    title: 'Gatsby + Builder.io Starter',
    description:
      'This repo contains an example website that is built with Builder.io, and generate with Gatsby'
  },
  plugins: [
    'gatsby-plugin-top-layout',
    // If you want to use styled components you should add the plugin here.
    // 'gatsby-plugin-styled-components',
    // 'gatsby-plugin-react-helmet',
    {
      resolve: '@builder.io/gatsby',
      options: {
        publicAPIKey: config.builderAPIKey,
        templates: {
          // Render every `landingPage` model as a new page using the 
          // src/templates/LandingPage.jsx template based on the URL provided in Builder.io
          blogPage: path.resolve('./src/templates/BlogPage.jsx'),
          landingPage: path.resolve('./src/templates/LandingPage.jsx'),
        }
      }
    }
  ]
};

but even though I have specified to use these different templates for above mentioned model types. Only the first mentioned template would be loaded for each page that I create using either models. In this case it would be BlogPage.jsx. I have fully explained what I'm trying to do and the issue as well here https://forum.builder.io/t/creating-a-blog-with-gatsby/1872/3?u=shehan thinking that it is something that I have done wrong. But I think this is a Bug.

Expected behavior To be able to use separate templates for different models which are specified in the @builder.io/gatsby plugin config

shehan-mark avatar Mar 14 '22 10:03 shehan-mark