TryGhost / express-hbs

Express handlebars template engine with inheritance, partials, i18n and async helpers.
MIT License
459 stars 77 forks source link

Content blocks cannot be used more than once #78

Closed brentonhouse closed 4 years ago

brentonhouse commented 9 years ago

If I am defining a block like this:

{{#contentFor "page_title"}}
    Dashboard Home
{{/contentFor}}

And using it like this:

<title>{{{block "page_title"}}}</title>
<h1>{{{block "page_title"}}}</h1>

The second usage doesn't work. It seems after the first time it is used, it is cleared out (to free memory).

https://github.com/barc/express-hbs/blob/master/lib/hbs.js#L37

this.blocks[name] = null;
bradvogel commented 9 years ago

+1. Here's another common use case for content blocks that breaks because of this bug:

    {{#if (block 'pageTitle')}}
    <title>{{block 'pageTitle'}}</title>
    {{/if}}
bradvogel commented 8 years ago

ping on this :)

jtwebman commented 5 years ago

Is this still an issue with the latest. I remember seeing some cache stuff in there.

ErisDS commented 4 years ago

Closing out all old issues. If this is still an issue with the latest version please let us know.

skeggse commented 4 years ago

This does appear to be fixed, at least on 2.3.0 (didn't test others).