question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Content blocks cannot be used more than once

See original GitHub issue

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;

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bradvogelcommented, Apr 21, 2015

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

    {{#if (block 'pageTitle')}}
    <title>{{block 'pageTitle'}}</title>
    {{/if}}
0reactions
skeggsecommented, Mar 5, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reusing content with content blocks - Zendesk help
Content blocks let you create content that you can share between multiple articles. This is useful for content such as disclaimers or ...
Read more >
About Content Blocks for Landing Pages - Mailchimp
Drag-and-drop content blocks make it easy to customize your Mailchimp landing pages. Use content blocks to add or edit text, images, products, promo...
Read more >
Content Blocks - Braze
This reference article explains how to use the Content Blocks Library to manage your reusable, cross-channel content in a single, centralized location.
Read more >
What Are Content Blocks and How Do I Use Them?
The text block allows you to customize your writing using different fonts, colors, sizes, alignments, and more. You can also insert links or ......
Read more >
Cannot edit content blocks after publishing the page in more ...
Cannot edit content blocks after publishing the page in more than one language using a synced strategy. ... 1. Create a page and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found