# Discourse comments in Vuejs

**URL:** https://meta.discourse.org/t/discourse-comments-in-vuejs/106128
**Category:** Development
**Created:** [1월 9, 2019, 11:18오후 UTC](https://meta.discourse.org/t/discourse-comments-in-vuejs/106128 "2019-01-09T23:18:17Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ahab4ik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ahab4ik/32/128649_2.png) [@ahab4ik](https://meta.discourse.org/u/ahab4ik)
#### Post date: [1월 9, 2019, 11:18오후 UTC](https://meta.discourse.org/t/discourse-comments-in-vuejs/106128/1 "2019-01-09T23:18:17Z")

</div>

I have a website that uses Vuejs. And a forum in Discourse. I am trying to insert a javascript in the template file that will connect comments from the forum to a specific page on Vuejs site. But I get the error:

```plaintext
Templates should only be responsible for mapping the state to the UI. 
Avoid placing tags with side-effects in your templates, such as <script>, 
as they will not be parsed.

```

I was try change `text/javascript` to `application/javascript` , but when i try render it, i receive error:

```plaintext
 - invalid expression: missing ) after argument list in

" \n DiscourseEmbed = { discourseUrl: 'https://forum.epicseven.ru/',\n                     
discourseEmbedUrl: '"+_s(url absolute="true")+"' };\n\n (function() {\n    
var d = document.createElement('script'); d.type = 
'application/javascript'; d.async = true;\n d.src = 
DiscourseEmbed.discourseUrl + 'javascripts/embed.js';\n    
(document.getElementsByTagName('head')[0] || 
document.getElementsByTagName('body')[0]).appendChild(d);\n })();\n"

  Raw expression: DiscourseEmbed = { discourseUrl: 
'https://forum.epicseven.ru/',
                 discourseEmbedUrl: '{{url absolute="true"}}' };

  (function() {
    var d = document.createElement('script'); d.type = 
'application/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || 
document.getElementsByTagName('body')[0]).appendChild(d);
  })();

```

As I understand it, the use of js files in Vuejs is allowed only from the domain from which the call originates. And my forum is set to subdomainю

How i can fix this error? Maybe try to use different part of code?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [1월 10, 2019, 2:23오후 UTC](https://meta.discourse.org/t/discourse-comments-in-vuejs/106128/2 "2019-01-10T14:23:37Z")

</div>

> [@ahab4ik](#):
>
> I have a website that uses Vuejs. And a forum in Discourse. I am trying to insert a javascript in the template file that will connect comments from the forum to a specific page on Vuejs site

The embedding code we provide is meant for static sites, not client side rendered (SPAs) like Vue/React/Ember/Angular.

You will have to look into another method of obtaining the data from Discourse. We do offer a [full API](https://docs.discourse.org/) but you might have to proxy it through your own server to avoid cross domain requests.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [12월 18, 2021, 8:42오후 UTC](https://meta.discourse.org/t/discourse-comments-in-vuejs/106128/3 "2021-12-18T20:42:16Z")

</div>



---

<div class="post-metadata">

### Author: ![MK2k](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mk2k/32/49271_2.png) [@MK2k](https://meta.discourse.org/u/MK2k)
#### Post date: [7월 3, 2022, 1:46오후 UTC](https://meta.discourse.org/t/discourse-comments-in-vuejs/106128/4 "2022-07-03T13:46:41Z")

</div>

저도 같은 문제를 겪었는데, 조금 만져본 끝에 단일 페이지 애플리케이션에 적용할 수 있는 해결책 하나를 찾았습니다: [Embed comments from Discourse in your single page app](https://meta.discourse.org/t/how-to-embedding-discourse-comments-in-your-blog-running-as-a-single-page-application-angular-vue-react-etc/231798)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [10월 27, 2022, 8:48오후 UTC](https://meta.discourse.org/t/discourse-comments-in-vuejs/106128/5 "2022-10-27T20:48:04Z")

</div>

이 주제는 마지막 답변 후 30일이 지나면 자동으로 닫힙니다. 더 이상 새 답변을 작성할 수 없습니다.
