simonrice/middleman-disqus — pull request #11 by komor72 (2014-11-04 20:21:15+00:00)
Title: Added per call options

Hi. I'd like to add a possibility to add options when using `disqus` helper in your layout/page. Why setting options during the call instead in the frontmatter of the page? Because Middleman is all about automating tedious tasks that can be automated. :)
A useful case is constructing `disqus_url` parameter from the global project’s site-url (project setting) and page-specific `disqus_identifier` set in frontmatter. Not setting the `disqus_url` can [spoil your production's server topic-url, if you preview your build locally on development machine](https://help.disqus.com/customer/portal/articles/735138-why-are-the-wrong-urls-detected-for-my-discussions-) so we should set both parameters on every page, like this:

```
---
disqus_identifier: /2012/the-best-day-of-my-life.html
disqus_url: http://example.com/2012/the-best-day-of-my-life.html
---
```

While Middleman evaluates current page, we already know the final URL for that page, thus constructing `disqus_url` can be automated, which reduces clutter in frontmatter and removes one possibility of mistake. It can be constructed in the article-template and used when calling the `disqus` helper. So, after removing the `disqus_url` from the frontmatter, my `article-layout.erb` file has:

```

<%= disqus disqus_url: ("http://example.com" + current_page.url) %>

```

Question: currently options passed to helper call will override options set in frontmatter. Maybe this should be opposite? Then frontmatter would override the page-template code.

Guys, my code change is relatively simple, and I've added 2 tests, but please review this, since I don't have much experience in digging Rails-type infrastructure, using Cucumber etc. Thanks! Bumped the version number, I hope this is correct.

BTW, I've corrected one comment left from middleman-google-analytics code.