2016-05-17 11 views
0

解決如何使Disqus能夠使用url路由?

我貼在我的網站默認Disqus代碼:

... 

var disqus_config = function() { 
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable 
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable 
}; 

... 

我的網站使用聚合物路由(我有<section></section>一個HTML文件的每一頁)

作爲一個路由我有:

... 
     page('/contact', function() { 
     app.route = 'contact'; 
     setFocus(app.route); 
     ga('set', 'page', '/contact'); 
     ga('send', 'pageview'); 
    }); 

     page('/privacy_policy', function() { 
     app.route = 'privacy_policy'; 
     setFocus(app.route); 
     ga('set', 'page', '/privacy_policy'); 
     ga('send', 'pageview'); 
    }); 
... 

爲每個頁面。

Disqus無法正常工作,當我打開Disqus管理面板時,它只顯示我對{{baseurl}}。url的評論的鏈接,儘管我從baseurl.com/page/發表了評論

我應該怎麼放,而不是:

this.page.url = PAGE_URL; 
this.page.identifier = PAGE_IDENTIFIER; 

我無法弄清楚如何把app.route = 'contact';那裏,因爲this.page.url = app.route = 'contact';結構是沒有意義的,我不能把直接的聯繫,因爲有HTTPS: // - 將在代碼中打開註釋。

回答

1

解決它:

要解決此問題,只是

var disqus_config = function() { 
this.page.url = 'https://www.YourSiteName.com/YourRoutePageName'; 
this.page.identifier = 'SomeUniqueIdGoesHere'; 
}; 

通知的HTTPS有取代

var disqus_config = function() { 
this.page.url = PAGE_URL; 
this.page.identifier = PAGE_IDENTIFIER; 
}; 

。如果你不使用HTTPS ,只是把HTTP代替

更多關於這一點,閱讀https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables