Get current url query string
<p>I'm trying to write a handlebars helper that spits out the current url query string. I will then use that query string to populate a template. I'm using assemble to do the html file generation.</p>

<p>My urls look like this: <code>groups/group-details/?id=1</code> and I want to get at the id value.</p>

<p>Here is my helper:</p>

<pre><code>Handlebars.registerHelper('currentId', function() {
    return document.location.search.split('?')[1].split('=')[1];
});
</code></pre>

<p>And I am calling it in my .hbs template like this:</p>

<pre><code>{{currentId}}
</code></pre>

<p>I am expecting it to just spit out <code>1</code> in this example but nothing is shown.</p>

<p>Where am I going wrong?</p>

<p><strong>- Edit -</strong></p>

<p>Digging around in the web inspector console shows my helper is registered but if I put a breakpoint on the return statement, it never gets hit. I assume the helper just isn't being 'executed'.</p>