arvgta / ajaxify

Ajaxify - The Ajax Plugin
https://4nf.org/
274 stars 124 forks source link

WordPress integration URL Refresh #157

Closed ugurcanbulut closed 5 years ago

ugurcanbulut commented 5 years ago

Hi there,

First of all, thank you so much for such an amazing plugin.

As you can see from the title, I'm having some issues on WordPress integration. The problem is, everything is working except the URL refresh, but only with taxonomies (categories, tags, custom taxonomies).

http://moam.ulbdesign.com/blog/

For example, when you click on a "category link (grey text above post title)" or "life cycle of the song boxes (they're custom taxonomies)", it goes to the relevant page but the URL doesn't change.

Any help would be appreciated!

Thanks

arvgta commented 5 years ago

Hi,

glad you like it :)

Have you got it working in the meantime? I tested the following links:

...and the URL does change?

(tested on Google Chrome)

Thanks

ugurcanbulut commented 5 years ago

Hi,

Thank you for the prompt reply!

No I haven't to be honest. I was trying some other plugins to see if they have the same issue. But only Ajaxify does have this problem. And the thing is, Ajaxify is way better plugin comparing to others. But I really would like to get over with this URL update issue.

Here I've updated back to Ajaxify: http://moam.ulbdesign.com/blog/

I still got the issue. I've tried some other ways to fix it with no luck. And I'm not sure why this happens.

ugurcanbulut commented 5 years ago

Here you have the proof.

1 2

It's really weird, because rest of the website works like a charm. Browser back/forward functionality, URL update, memory and prefetch. And "bodyClasses: true" is also such an awesome feature which other plugins have some issues with it.

For example, these guys are using your plugin too: http://themenectar.com/demo/salient-startup/

And it seems they have a similar issue because I found this piece of code in their js file - which didn't work for me either : )

var $hash = window.location.hash;

var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1,$hash.length) : 0;

//if hash has slashes 
var $hasSlashLength = 0;
if($hashSubstrng) {
    $hasSlashLength = $hashSubstrng.split("/");
    $hasSlashLength = $hasSlashLength.length;
}

if($hashSubstrng && $hasSlashLength > 1 ) { 
    $hashSubstrng = $hashSubstrng.replace(/\//g, ""); 
    $hash = $hash.replace(/\//g, ""); 
}
arvgta commented 5 years ago

Hi, I'm out of office at the moment. It's a long shot, but maybe try toggling the "canonical" parameter? Will be back in the office tomorrow probably

ugurcanbulut commented 5 years ago

It worked! I didn't think of that : ) Thank you so much!

arvgta commented 5 years ago

That's great! Thank you, too, very much!

arvgta commented 5 years ago

If, and only if you feel like it, you could point out, which features my plugin doesn't have, that others cover? I have the feeling you know the market better than me :) I noticed, that others like SmoothState or even PJAX seem to have stopped their R&D at GitHub?

ugurcanbulut commented 5 years ago

Of course, I would be happy to help you with that. Let me get back to you in a few days. I also want to speak with my other developer friends from various fields. I'm WordPress developer but I have friends who are specialized with pure PHP, vanilla JS etc.

arvgta commented 5 years ago

Please excuse the heavy delay and thanks very much, once again! Looking forward, to what your peer developers say...


So, to wrap this issue up, the workaround was to specify:

canonical: false

...but I think this should be fixed properly and thoroughly within Ajaxify. Closing this issue now, because a workaround has been found, but we'll start another thread dedicated to fixing the bug properly and also another one asking, how Ajaxify compares to other frameworks, which was the other question raised in this issue...