Disqus comments system don't work with Unpoly

64 views
Skip to first unread message

abdullaha...@gmail.com

unread,
May 30, 2021, 3:19:23 PM5/30/21
to unpoly

Currently I'm building a blog using Django and Unpoly, I'm using the Disqus comments system
on the detail article page.

https://github.com/alnuaimi94/Personal-Website

The problem is that the comments system does not appear until I make a forced reload of the page.

adam12 tried to help me on unpoly github issues but his codes do'nt works

https://github.com/unpoly/unpoly/issues/170

Are there suggestions or instructions regarding that?

adam.me...@gmail.com

unread,
May 31, 2021, 10:47:41 AM5/31/21
to unpoly
Are there any errors? Do you have a branch that you made my suggested changes to that we can see where it failed? if so, please link us.

We need more to go on.

John Wells

unread,
Jun 7, 2021, 10:07:50 AM6/7/21
to unp...@googlegroups.com
I've integrated Disqus with Unpoly 1.x, and it indeed did take some wrangling. I also am using AlpineJS, and loadJS for more lazyloading, so it's a little difficult to abstract my code into a generic solution (without time which I don't have!), but hopefully this snippet from my Alpine component's init() will help:


HTH!



--
You received this message because you are subscribed to the Google Groups "unpoly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unpoly+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unpoly/2d069df9-1332-4da6-acd6-cc36c416d853n%40googlegroups.com.


--
Pura Vida
John D Wells
http://www.johndwells.com

Jean de La Fontaine

unread,
Jun 25, 2021, 1:23:06 PM6/25/21
to unpoly
Hey John, how do you make Alpine work with Unpoly? un.compiler not working for me if I don't do a hard refresh.

adam.me...@gmail.com

unread,
Jun 25, 2021, 4:03:04 PM6/25/21
to unpoly
I use this compiler in a project.

up.on('up:fragment:inserted', (ev, fragment) => {
Alpine.discoverUninitializedComponents(function(el){ Alpine.initializeComponent(el) })
})

John Wells

unread,
Jun 30, 2021, 6:35:53 AM6/30/21
to unp...@googlegroups.com
This is what I did for Unpoly 0.6.2 + AlpineJS 2.8.2:

up.on('up:fragment:inserted', function (event, fragment) {
  if (!event.target.matches('body')) return;
  up.log.debug('Starting Alpine');
  Alpine.start();
});

Basically my experience was that only if Unpoly was replacing the entire body tag, did I need to tell Alpine to start. Otherwise everything else "just worked".

I haven't had a clear chance to test Unpoly 1x + Alpine 3x.

Jean de La Fontaine

unread,
Jun 30, 2021, 4:04:28 PM6/30/21
to unpoly
Thanks guys. I'm using Unpoly 2 + Alpine 3 and everything seems to be working great. I think my problem was because of using inline scripts. 

From time to time Unpoly 2 seems completely ignored and my requests go full http reload. Maybe Unpoly is failing silently, I will enable logging just to be sure. 

Reply all
Reply to author
Forward
0 new messages