{"id":15046280,"url":"https://github.com/docpad/docpad-plugin-handlebars","last_synced_at":"2025-10-26T14:31:36.279Z","repository":{"id":5092251,"uuid":"6254776","full_name":"docpad/docpad-plugin-handlebars","owner":"docpad","description":"Adds support for the Handlebars templating engine to DocPad.","archived":false,"fork":false,"pushed_at":"2024-02-19T20:25:56.000Z","size":248,"stargazers_count":7,"open_issues_count":14,"forks_count":12,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-01-31T20:49:49.953Z","etag":null,"topics":["docpad-plugin"],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"cstar/erls3","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docpad.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["balupton"],"patreon":"bevry","open_collective":"bevry","ko_fi":"balupton","liberapay":"bevry","custom":["https://bevry.me/fund"]}},"created_at":"2012-10-17T02:00:35.000Z","updated_at":"2020-10-29T10:07:02.000Z","dependencies_parsed_at":"2024-06-21T04:19:42.858Z","dependency_job_id":"abd8c2ae-1c7d-436e-95e8-a161d7c6b0dc","html_url":"https://github.com/docpad/docpad-plugin-handlebars","commit_stats":{"total_commits":63,"total_committers":9,"mean_commits":7.0,"dds":0.2857142857142857,"last_synced_commit":"41b77844ccaa9fe1760608235f601b34d8ca4b0f"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-handlebars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-handlebars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-handlebars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-handlebars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docpad","download_url":"https://codeload.github.com/docpad/docpad-plugin-handlebars/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238347827,"owners_count":19457001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docpad-plugin"],"created_at":"2024-09-24T20:52:56.844Z","updated_at":"2025-10-26T14:31:35.894Z","avatar_url":"https://github.com/docpad.png","language":"CoffeeScript","funding_links":["https://github.com/sponsors/balupton","https://patreon.com/bevry","https://opencollective.com/bevry","https://ko-fi.com/balupton","https://liberapay.com/bevry","https://bevry.me/fund","https://buymeacoffee.com/balupton"],"categories":[],"sub_categories":[],"readme":"# Handlebars Plugin for [DocPad](https://docpad.org)\n\n\u003c!-- BADGES/ --\u003e\n\n\u003cspan class=\"badge-travisci\"\u003e\u003ca href=\"http://travis-ci.com/docpad/docpad-plugin-handlebars\" title=\"Check this project's build status on TravisCI\"\u003e\u003cimg src=\"https://img.shields.io/travis/com/docpad/docpad-plugin-handlebars/master.svg\" alt=\"Travis CI Build Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-npmversion\"\u003e\u003ca href=\"https://npmjs.org/package/docpad-plugin-handlebars\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/docpad-plugin-handlebars.svg\" alt=\"NPM version\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-npmdownloads\"\u003e\u003ca href=\"https://npmjs.org/package/docpad-plugin-handlebars\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/docpad-plugin-handlebars.svg\" alt=\"NPM downloads\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-daviddm\"\u003e\u003ca href=\"https://david-dm.org/docpad/docpad-plugin-handlebars\" title=\"View the status of this project's dependencies on DavidDM\"\u003e\u003cimg src=\"https://img.shields.io/david/docpad/docpad-plugin-handlebars.svg\" alt=\"Dependency Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-daviddmdev\"\u003e\u003ca href=\"https://david-dm.org/docpad/docpad-plugin-handlebars#info=devDependencies\" title=\"View the status of this project's development dependencies on DavidDM\"\u003e\u003cimg src=\"https://img.shields.io/david/dev/docpad/docpad-plugin-handlebars.svg\" alt=\"Dev Dependency Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cbr class=\"badge-separator\" /\u003e\n\u003cspan class=\"badge-githubsponsors\"\u003e\u003ca href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-flattr\"\u003e\u003ca href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"\u003e\u003cimg src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-liberapay\"\u003e\u003ca href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"\u003e\u003cimg src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-opencollective\"\u003e\u003ca href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"\u003e\u003cimg src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-crypto\"\u003e\u003ca href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"\u003e\u003cimg src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-paypal\"\u003e\u003ca href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-wishlist\"\u003e\u003ca href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"\u003e\u003cimg src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n\u003c!-- /BADGES --\u003e\n\n\nAdds support for the [Handlebars](http://handlebarsjs.com/) templating engine to [DocPad](https://docpad.org)\n\nConvention:  `.(inlinejs|js|anything).(handlebars|hbs|hb)`\n\n\n\n\n\n## Configuration\n\n### Getting helpers and partials to work\n\nFor the plugin to support helpers and partials, you'll have to add something like the following to your [docpad configuration file](http://docpad.org/docs/config) manually:\n\n``` coffee\n# ...\nplugins:\n\thandlebars:\n\t\thelpers:\n\t\t\t# Expose docpads 'getBlock' function to handlebars\n\t\t\tgetBlock: (type, additional...) -\u003e\n\t\t\t\tadditional.pop() # remove the hash object\n\t\t\t\t@getBlock(type).add(additional).toHTML()\n\t\tpartials:\n\t\t\ttitle: '\u003ch1\u003e{{document.title}}\u003c/h1\u003e'\n\t\t\tgoUp: '\u003ca href=\"#\"\u003eScroll up\u003c/a\u003e'\n# ...\n```\n\nIn your handlebars template you will need to use {{{content}}} to prevent handlebars from escaping any html content. You also cannot use helper functions as a parameter to {{#each collection}}, instead you should define a templateData variable and map the name to a @getCollection call e:g:\n```\n    sitePages: -\u003e\n      @getCollection(\"pages\").toJSON()\n```\n\n## Usage as precompiler\n\nIf the document extension is `.(inlinejs|js).(handlebars|hbs|hb)`, the plugin will produce a precompiled template. In this case, you can customise the precompiled template via the following:\n\n``` coffee\n# ...\nplugins:\n\thandlebars:\n\t\tprecompileOpts:\n\t\t\twrapper: \"default\"\n# ...\n```\n\nAvailable values for the wrapper option are:\n\n- `\"default\"`: Produces a handlebars wrapper like:\n\t``` javascript\n\t(function() {\n\t\tvar template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};\n\t\ttemplates['theSlugOfTheFile'] = template(function (Handlebars,depth0,helpers,partials,data) {\n\t\t\t...\n\t\t})\n\t})();\n\t```\n\n- `\"amd\"`: Produces a AMD handlebars wrapper like:\n\t``` javascript\n\tdefine(['handlebars'], function(Handlebars) {\n\t\tvar template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};\n\t\ttemplates['theSlugOfTheFile'] = template(function (Handlebars,depth0,helpers,partials,data) {\n\t\t\t...\n\t\t});\n\t});\n\t```\n\n- `\"none\"`:  Produces a basic wrapper like:\n\t``` javascript\n\tfunction (Handlebars,depth0,helpers,partials,data) {\n\t\t...\n\t}\n\t```\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u003c!-- INSTALL/ --\u003e\n\n\u003ch2\u003eInstall\u003c/h2\u003e\n\nInstall this DocPad plugin by entering \u003ccode\u003edocpad install handlebars\u003c/code\u003e into your terminal.\n\n\u003c!-- /INSTALL --\u003e\n\n\n\u003c!-- HISTORY/ --\u003e\n\n\u003ch2\u003eHistory\u003c/h2\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/blob/master/HISTORY.md#files\"\u003eDiscover the release history by heading on over to the \u003ccode\u003eHISTORY.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /HISTORY --\u003e\n\n\n\u003c!-- CONTRIBUTE/ --\u003e\n\n\u003ch2\u003eContribute\u003c/h2\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/blob/master/CONTRIBUTING.md#files\"\u003eDiscover how you can contribute by heading on over to the \u003ccode\u003eCONTRIBUTING.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /CONTRIBUTE --\u003e\n\n\n\u003c!-- BACKERS/ --\u003e\n\n\u003ch2\u003eBackers\u003c/h2\u003e\n\n\u003ch3\u003eMaintainers\u003c/h3\u003e\n\nThese amazing people are maintaining this project:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"https://github.com/balupton\"\u003eBenjamin Lupton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository docpad/docpad-plugin-handlebars\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://meltmedia.com\"\u003eMike Moulton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/commits?author=mmoulton\" title=\"View the GitHub contributions of Mike Moulton on repository docpad/docpad-plugin-handlebars\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003ch3\u003eSponsors\u003c/h3\u003e\n\nNo sponsors yet! Will you be the first?\n\n\u003cspan class=\"badge-githubsponsors\"\u003e\u003ca href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-flattr\"\u003e\u003ca href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"\u003e\u003cimg src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-liberapay\"\u003e\u003ca href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"\u003e\u003cimg src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-opencollective\"\u003e\u003ca href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"\u003e\u003cimg src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-crypto\"\u003e\u003ca href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"\u003e\u003cimg src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-paypal\"\u003e\u003ca href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-wishlist\"\u003e\u003ca href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"\u003e\u003cimg src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n\u003ch3\u003eContributors\u003c/h3\u003e\n\nThese amazing people have contributed code to this project:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"https://github.com/balupton\"\u003eBenjamin Lupton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository docpad/docpad-plugin-handlebars\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/gbouthenot\"\u003eGilles Bouthenot\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/commits?author=gbouthenot\" title=\"View the GitHub contributions of Gilles Bouthenot on repository docpad/docpad-plugin-handlebars\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://meltmedia.com\"\u003eMike Moulton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/commits?author=mmoulton\" title=\"View the GitHub contributions of Mike Moulton on repository docpad/docpad-plugin-handlebars\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/RobLoach\"\u003eRob Loach\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/commits?author=RobLoach\" title=\"View the GitHub contributions of Rob Loach on repository docpad/docpad-plugin-handlebars\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/macta\"\u003eTim Mackinnon\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/commits?author=macta\" title=\"View the GitHub contributions of Tim Mackinnon on repository docpad/docpad-plugin-handlebars\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/toabi\"\u003eTobias Birmili\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/commits?author=toabi\" title=\"View the GitHub contributions of Tobias Birmili on repository docpad/docpad-plugin-handlebars\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/vsopvsop\"\u003evsopvsop\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/commits?author=vsopvsop\" title=\"View the GitHub contributions of vsopvsop on repository docpad/docpad-plugin-handlebars\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-handlebars/blob/master/CONTRIBUTING.md#files\"\u003eDiscover how you can contribute by heading on over to the \u003ccode\u003eCONTRIBUTING.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /BACKERS --\u003e\n\n\n\u003c!-- LICENSE/ --\u003e\n\n\u003ch2\u003eLicense\u003c/h2\u003e\n\nUnless stated otherwise all works are:\n\n\u003cul\u003e\u003cli\u003eCopyright \u0026copy; 2012+ \u003ca href=\"http://meltmedia.com\"\u003eMike Moulton\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\nand licensed under:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"http://spdx.org/licenses/MIT.html\"\u003eMIT License\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003c!-- /LICENSE --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocpad%2Fdocpad-plugin-handlebars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocpad%2Fdocpad-plugin-handlebars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocpad%2Fdocpad-plugin-handlebars/lists"}