Skip to content

How to use something like partials in HandlebarsJS #55

Closed Answered by rehhouari
bartonhammond asked this question in Q&A
Discussion options

You must be logged in to vote

glad you found this helpful!
as for your question, I'm not familiar with handlebars but it seems Partials are made for re-usability.
this plugin's templates are meant for displaying pages rather than a full fledged templating system such as handlebars so i'm not sure if you can achieve this without another plugin.

what I do myself is I've started using Astro.js along with Alpine.js and pinecone router, the former has a component system with no client-side runtime and builds into html.
of course this isn't a valid solution if you don't use or want to use a build tool.

you can however implement a simple utility to fetch html files and show them conditionally, something like this:

<script>
d…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bartonhammond
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