Same issue as others, unique identifier not working
mjalindahl opened this issue · comments
I have gotten vue-disqus to show up, but each page has different results on whether or not it's going to show old comments or blank comments.
I have tried:
<vue-disqus shortname="name" :identifier="$route.params.id"></vue-disqus>
mounted() {
var vm = this
vm.disqus_id = this.$route.params.id
vm.disqus_url = 'https://website.com/#/gallery/view/'+vm.disqus_id
}
//with
<vue-disqus shortname="name" :identifier="disqus_id" :url="disqus_url"></vue-disqus>
Nothing seems to be working. Is this a good way to do it? Basing it off the url? You can see the identifier
and url
are being set.
Thanks in advance.
@mjalindahl
Thanks for using.
Try only by passing the shortname.
<vue-disqus shortname="my_shortname_disqus" />
I think this is caused by the component not responsive to identifier change...
Hi @ktquez, I tried that, but still same comments on each page.
@alijaya I thought so too, but when you hover over the "Sort By Best" section, you can see the URL is being built from my variables. Is there any other way to be absolutely certain Disqus is getting the right identifier and URL and it's not somehow being replaced later after being mounted()
or something? I tried the other recommendation of doing a v-if
once the identifier
is set, but that didn't seem to work either.
The t_i
in the URL is the identifier, and the t_u
is the URL that I'm sending. It seems like it's getting both of these on their end.
Thanks for the help so far.
Even after removing everything except for the shortname, the same comments still load. It's as if Disqus has already made up its mind how to associate the posts with the pages. Absolutely nothing changes if I put in random characters for the identifier and URL.
Maybe this helps?
@mjalindahl
Can you put some preview online?
@mjalindahl : hey... I have found the solution for this... basically, Disqus doesn't support "hash" mode in url like #/
, but they support hashbang mode #!/
(which is doesn't exist in Vue 2, there's a workaround about that)
So... the best way is... to make your router.mode in "history", and reset your disqus site (like deleting and make new).
So for detailed problem, maybe it's better if we know how Disqus search link the page with the thread:
- First it see if we set the
identifier
, if it's defined, it will search based on identifier - If it's undefined, it will use
url
to search, if it's defined, it will search based on url - If it's undefined, it will use
window.location
asurl
, and this is where disqus will play some trick, it will ignore all after#
, sohttps://example.com/test
will have sameurl
ashttps://example.com/test#somehash
, and because of this if you are inhash
mode,https://example.com/
will have sameurl
ashttps://example.com/#/test
. Except if it's hashbang#!
, it won't be ignored - If it search with
identifier
, it will search the thread with suitableidentifier
, some caveat here, a thread can have multipleidentifier
. If it finds, it returns the thread - If not, it will search based on the
url
, url is unique to a thread, if it finds, it returns it. - If not, it will create new thread, and return it.
Example:
You have identifier
of foo
with url
of https://example.com/#/foo
.
It searches the database, it doesn't have any entry yet, so it creates new one with:
[
{
identifiers: [ 'foo' ],
url: 'https://example.com'
}
]
Then you have another page with identifier
of baz
and url
of https://example.com/#/baz
.
It searches for baz
, not found. Then search the and found https://example.com/
(remember that it ignores the hash
?), it returns it. So the database becomes this:
[
{
identifiers: [ 'foo', 'baz' ]
url: 'https://example.com'
}
]
So the two pages refers to the same thread. Which is annoying.
And if you now want to change it to history
mode, so foo
page will have url
of https://example.com/foo
.
But remember that it searches first for foo
identifier? And it matches the one and only thread that we have.
The same with the baz
.
So you need to clear up all the database first (thus delete and create new), and then don't forget to use history
mode.
@alijaya Thank you so much for your input. I'll do that and check in later today. This sounds promising.
@alijaya
Awesome, I had not noticed the hash in the URL, thanks.
@mjalindahl
I'll add yes, thank you
cool :D... great to hear that :D