Combining embedded scripts with template data

17 views
Skip to first unread message

Aaron Powell

unread,
Sep 22, 2011, 9:25:05 AM9/22/11
to coff...@googlegroups.com
I've got a template which I'm passing in some data to and it's all well and good to access in HTML tags that I'm generating, but I'm wanting to use it in some JavaScript that I'm outputting.

This is what I've tried to use:

  coffeescript ->
    $ ->
      window.disqus_identifier= @Document.slug
      window.disqus_developer= document.location.href.indexOf("localhost")
      window.disqus_url= @Document.url
      if typeof window.DISQUS isnt "undefined"
        window.DISQUS.reset
          reload: yes
          config: ->
            @page.identifier = @Document.slug
            @page.url = @Document.url

But the problem is that @Document.slug (and others) aren't evaluated. Can I get them evaluated, and if so how?
Reply all
Reply to author
Forward
0 new messages