MurhafSousli/ngx-disqus

ngx-disqus module in ionic v3 only displays one thread

Closed this issue · 4 comments

I have imported ngx-disqus module to the page.module.ts in my ionic v3 progressive web app like this:
`import { DisqusModule } from 'ngx-disqus';

@NgModule({
declarations: [
SzenarioerstellungPage,
],
imports: [
IonicPageModule.forChild(SzenarioerstellungPage),
DisqusModule.forRoot('my_shortname'),
],
exports: [
SzenarioerstellungPage
]
})
export class SzenarioerstellungPageModule {}`

This is how I use it in mypage.html file:

<disqus [identifier] = "pageId" ></disqus>

And this is how I set the pageId:

`ionViewDidLoad() {
this.szenarioProvider.getUserID().then( UID => {
this.pageId = UID;
});

}`

As you can see, I want to use the unique ID of the user (which he got from firebase authentification) to display a unique discus-thread on his page.

The problem is now that no matter what user gets to this page, discus only shows one and the same thread, instead of individual threads for each user.

Note: no matter what user enters the mentioned page, it always has the same URL (ionic does it like this.): http://localhost:8100/#/szenarioerstellung

But I thought, that the unique [indentifier] would solve this problem.

Do you know, what I did wrong or what I need to add/ have in mind?

DISQUS does NOT work when the # is used in the router.

for example the URL http://localhost:8100/#/szenarioerstellung is read as http://localhost:8100/, so no matter how the URL changes, it will still look the same on DISQUS side.

There are 2 solutions:

1 - Find a way to configure your router to use the hashbang #! instead of #

2 - Disable the HashLocationStrategy from the Router so it becomes like the standard URL http://localhost:8100/szenarioerstellung.

Read the requirement section in Using Disqus on AJAX sites

I used import { Routes, RouterModule } from '@angular/router'; to avoid the # in the URL. But Nevertheless disqus only displayed one thread. So I think that the # cannot be the only problem.

Do you have any suggestions?

@VanSan888 Sorry for late response.
Actually It is the only problem, your disqus is getting the same URL again and again, that is why it is giving you the same thread.

It is an incompatibility between Disqus and Ionic

  • DISQUS uses either a standard HTML5 path or a full hash bang path #!, see the docs.
  • Ionic uses the hash location strategy (I didn't investigate much but I haven't found a way to disable the # in ionic)