Replies: 2 comments 2 replies
-
It is possible, that I don't need the handlebars-layout plugin due to a reading of this blog post: https://cloudfour.com/thinks/the-hidden-power-of-handlebars-partials/. So this is just a side note :) |
Beta Was this translation helpful? Give feedback.
-
Ok, after reading the blog post, it was really removing the handlebars-layout plugin with vanilla handlebar features (partials, inline-partials, etc.). So I think I answered the question by my own, the data will be also part of the hbs files and will be loaded as includes/partials and will change the placeholder with the data. I was just wondering if this is just possible with JSON and not with hbs :) |
Beta Was this translation helpful? Give feedback.
-
I will try to use this plugin for handlebars: https://github.com/shannonmoeller/handlebars-layouts to create a layout file where I can just change the content inside. Each site will have the same layout but different content, index (startpage), imprint, contact, about me, etc. Not only the content will be different, also the meta data for the part of the files like different title for every page or other stuff. Maybe also activating the link of the menu when I navigate from the startpage to contact to get contact highlighted.
Without any testing atm, just had a look into the code, is there anything simple to use a json file or whatever is possible to change the {title} for example for each file that I have?
Atm, I use gulp 2, but it is deprecated and updating it will be more stress than creating it new and for this I had some gulp tasks to replace placeholders with the stuff. I never used real handlebars for this project until now but I already used handlebars and I know that the template() function will take the context and I see in your vite config, that I can add data to the context, but is there a possibility somehow to make the context specific to the pages or partials?
At the end, I will have a number of generated html files, which have the same header and footer but in the header there is different data, based on the file.
Beta Was this translation helpful? Give feedback.
All reactions