Jump to content

Jumplinks


Mike Rockett

Recommended Posts

I'm not sure how to set it up.

When specify a destination, it could only select a page from page tree or something like page:1017

1017 is the page id

but how to specify page id 1017 of other language ?

Due to the way the tree module works, I am not able to show the pages in all languages within Jumplinks. You may need to switch languages in the admin panel to see the pages in that language. You can also manually specify the destination without using the page tree or auto complete fields.

Link to comment
Share on other sites

The jumplink: 

[...]

works for the default language, the problem is when I try to redirect to the non-default language, Portuguese:

[...]

 BUT only redirects to the default language.

[...]

Or is there other workaround?

After playing around a bit I found the following workaround to force language specific redirects:

If you set the destination path to your language specific page the system will detect the related page and store the page as the target.

If you add a questionmark (introducing a querystring) at the end of the destination path jumplinks will leave the path as is and redirect will happen as expected.

This is not needed for redirects to the homepage.

Better solution would be to implement language specific targeting to the module. +1 to the wishlist from my side.

Link to comment
Share on other sites

After playing around a bit I found the following workaround to force language specific redirects:

If you set the destination path to your language specific page the system will detect the related page and store the page as the target.

If you add a questionmark (introducing a querystring) at the end of the destination path jumplinks will leave the path as is and redirect will happen as expected.

This is not needed for redirects to the homepage.

Better solution would be to implement language specific targeting to the module. +1 to the wishlist from my side.

Hi kixe - are you saying that if the module isn't storing the paths ID (page:id) in the database, but rather redirecting to its hardcoded URI, then it automatically redirects again to that same page in the correct language? (Forgive me if I've misunderstood... Also, not able to test right now - can only do so later today.)

Hi Mike

I have Jumplinks V 1.5.2 installed.

Same thing happened when I upgraded from PW 2.6.1 to 2.7.3. Possibly the same site.

I see - muct be an oversight on my side. Will try sort out a fix this afternoon (SAST)

Link to comment
Share on other sites

Hi kixe - are you saying that if the module isn't storing the paths ID (page:id) in the database, but rather redirecting to its hardcoded URI, then it automatically redirects again to that same page in the correct language? (Forgive me if I've misunderstood... Also, not able to test right now - can only do so later today.)

Example:

The website example.org is a multilanguage site with english as default language and german as second available language. The Name of the root page is 'en' for default language and 'de' for german.

If I want to redirect a not existing url to the new page with ID: 1234 and url '/en/archive/' I create a jumplink and type in '/en/archive/' as the target the system detects the page and stores: 'page:1234'

Redirect will target as expected to '/en/archive/'.

If I want to redirect to the page with ID: 1234 in the german version with url '/de/archiv/' I create a jumplink and type in '/de/archiv/' as the target the system detects the page and stores: 'page:1234' too.

Redirect will target  to '/en/archive/' and NOT to '/de/archiv/'.

To force a redirect to the german version I found a workaround by adding the questionmark (querystring) to the url. In this case the system doesn't detect the page and will store the path instead of the ID. Redirect will happen once and as expected.

Link to comment
Share on other sites

Example:

The website example.org is a multilanguage site with english as default language and german as second available language. The Name of the root page is 'en' for default language and 'de' for german.

If I want to redirect a not existing url to the new page with ID: 1234 and url '/en/archive/' I create a jumplink and type in '/en/archive/' as the target the system detects the page and stores: 'page:1234'

Redirect will target as expected to '/en/archive/'.

If I want to redirect to the page with ID: 1234 in the german version with url '/de/archiv/' I create a jumplink and type in '/de/archiv/' as the target the system detects the page and stores: 'page:1234' too.

Redirect will target  to '/en/archive/' and NOT to '/de/archiv/'.

To force a redirect to the german version I found a workaround by adding the questionmark (querystring) to the url. In this case the system doesn't detect the page and will store the path instead of the ID. Redirect will happen once and as expected.

Right, I see. Haven't worked on/with the module for a while, so forgot that it stores the Page ID when the hard-coded URI exists as a Page. The issue here is that I'm not experienced with regards to multi-lang sites. Do multi-lang pages share the same ID? So 1234 would represent both the English and German pages... No?

Link to comment
Share on other sites

I am experiencing this module to be a bit slow after a while. Note that I have not read the entire thread from 1 to 13 for solutions or limitation, just quick read a few pages. Or found anything on the webpage.

A few details on my installation:

  • About 330 jumplinks
  • It takes about 17 second to load the Jumplinks page/list
  • Registering new jumplinks also takes a good while (I am not sure if is because of saving or loading the Jumplinks page/list).
  • My webpage has about 120 000 pages.
  • Running 3.0.17

I can live with it being slow. Just thought I should mention it. And also hoping a little that there's a solution.

Link to comment
Share on other sites

I am experiencing this module to be a bit slow after a while. Note that I have not read the entire thread from 1 to 13 for solutions or limitation, just quick read a few pages. Or found anything on the webpage.

A few details on my installation:

  • About 330 jumplinks
  • It takes about 17 second to load the Jumplinks page/list
  • Registering new jumplinks also takes a good while (I am not sure if is because of saving or loading the Jumplinks page/list).
  • My webpage has about 120 000 pages.
  • Running 3.0.17

I can live with it being slow. Just thought I should mention it. And also hoping a little that there's a solution.

Hi laban,

Thanks for the insight on this - this is the first I'm hearing of Jumplinks running on a large site.

Jumplinks wasn't built for large sites - in fact, it wasn't something that crossed my mind when building it. That said, it does seem a little strange that this is happening. The only thing I think could slow it down is the multiple regex routines that the module makes use of - there are quite a lot, if you have a look at the code.

Without saying much more, I would be very interested to see a Blackfire/XDebug dump of this - perhaps I may be able to look into the details and speed up the new module. If you could do that for me, I'd be most grateful.

Unfortunately, I haven't been pyaing attention to the module of late - many other things on the plate at the moment. That said, I'm sure I'll be getting back into it soon with some new sites in the pipeline.

Thanks,

Mike

  • Like 1
Link to comment
Share on other sites

I have unfortunately no experience with debugging / BlackFire / XDebug. I have MAMP where I do my local development, and have activated Xdebug there, and downloaded MacGDBp. But that's all I have managed to do.

With some guidance there would of course be no problem for me to contribute! Is what I am saying. When you're ready.

Link to comment
Share on other sites

I have unfortunately no experience with debugging / BlackFire / XDebug. I have MAMP where I do my local development, and have activated Xdebug there, and downloaded MacGDBp. But that's all I have managed to do.

With some guidance there would of course be no problem for me to contribute! Is what I am saying. When you're ready.

I see - though, I admit: I'm pretty new to debug/profiling tools myself. It's quite simple, and I quite like XDebug, which is essentially a PHP extension that can profile your code as and when it is executed. It simply output the data to a file, which can then be opened using a client app.

I'll continue work on Jumplinks 2 as soon as I can. There are already performance boosts in terms of PW3 and the new module structure. Also, I think I'd like for the module to make use of SQL statements that limit what is returned - that way, it doesn't have to loop through large sets of data.

Lots of work ahead of me...

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
2 hours ago, OllieMackJames said:

I am on pw 2.7.3 and have jumplinks 1.5.2

I can not delete any jumplink, when I click on the source I just get taken to the add new jumplink page.

Would be nice if this could be fixed.

Thanks

Hi Ollie,

I'm not able to test right now due to a server upgrade. That said, please can you check what link shows up in the status bar when you hover over a source? Also, what happens when you navigate to <admin>/setup/jumplinks/entity/?id=1 manually?

Link to comment
Share on other sites

@OllieMackJames - Sorry, I had a typo there. Meant to ask what happens when you manually go to the URL with id=19, the same URL that appears when you hover over a link. Nonetheless, I think there is a problem, as going to id=1 should edit the first jumplink you created. if id=0, then the module should create a new jupmlink.

To be clear, if you navigate to /pwire/setup/jumplinks/entity/?id=19, do you get to the Register New Jumplink page, and does the URL change? And lastly, what version of PHP are you running?

Is anyone else experiencing this problem?

Link to comment
Share on other sites

  • 2 weeks later...

Just voted this module up, great work! I used this for the first time, a client needed simple redirects and the cPanel solution didn't work well. The module worked like a charm, thanks! Having a built-in role was also nice to see.

At first sight I feel that two simple additions would make the module smarter from the UI side:

  1. Enable/disable checkbox for individual jumplinks: this would make easier disable items without having to delete them
  2. Preview link for jumplinks - perhaps to open them in a modal window, or panel in PW3?
Link to comment
Share on other sites

@tpr - Thanks, glad you like it.

I have started building Jumplinks 2 from the ground up, but haven't had the time to continue work on it of late.

With regards to the state-toggle: I can implement this feature, but it would be turned off by default. That said, if the feature gets enabled, the jumplinks would all be created to redirect with status code 302/307 (actuallly not 100% sure which one is better). That said, is isn't necessary to do so, but not doing so would mean going against the intention of the different HTTP codes.

As for previews: these can be somewhat difficult, giving consideration to parameters - I think I may have brought this up before here. It would be easy to preview jumplinks that don't have parameters, but those that do have them would need user input in order to test.

This is all on my to-do list for the new module, which will be compatible with both PW 2.8 and 3.0.

  • Like 3
Link to comment
Share on other sites

Thanks, these make sense. Another feature request (from the client) is to be able to reset multiple or all jumplinks' hit counters. Currently there are only a few but this sounds handy, eg when going live and would like to start with a clean slate.

Looking forward to v2!

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Hi everyone, very sorry for the delays - as you may know, I've been too busy of late to attend to Jumplinks 2. I'm making time as a go along, and would like to briefly discuss the current work taking place.

I may or may not have mentioned that I'd like the new Jumplinks to be powered by FastRoute. This improves processing time by quite a bit (haven't measured, but there is far less preg_* going on) and makes development somewhat easier. By using it, however, the syntax for each jumplink would change; but I believe this to be a good thing.

As you well know, Jumplinks currently uses the {name:type} base syntax, where type is optional (this invokes smart wildcards). By moving to FastRoute, the base syntax would change to {name} only, which catches [^/]+ by default. That regex is typically used in an MVC framework context, and so may not be completely suitable for the purposes of this module - as such, I am sure this can be changed by overriding the RouteParser (we can default to what is currently used for the segment any type: [\w_-]+[\w.-_%\=\]+).

Then, the concept of smart wildcards would disappear, and you would be able to specify your own expressions instead - this is done in the format {name:<exp>}, where <exp> is the expression you would normally use inside of a regex capture group, such as [a-z0-9]+. However, we could add support for aliasing expressions so that the module behaves the same way as it currently does, by silently converting the aliases to their respective expressions, but also allowing more complex expressions to be used. (Note that I chose FastRoute as its syntax closely matches the current Jumplinks syntax, and allows for greater flexibility.)

Before Jumplinks 2 is launched, the current dev branch (which will then be moved to master) will be updated to include a JSON/CSV exporter to the Jumplinks 2 format. As an example, the exporter will automatically convert {page:segment} to {page:[\w_-]+}. However, if we choose to use the wildcard type aliasing (discussed above), then this exporter need only export the data on an as-is basis.

Note: Due to Jumplinks 2 development, all new features requested by the community will not be added to v1, but will be implemented in v2 instead. It will, however, be easy to migrate from v1 to v2 in order to use those features.

I also plan on making v2 compatible with only ProcessWire 2.8 and 3.0, and Mapping Collections will still be supported.

I'm writing about this now so that we can discuss it - I'd appreciate your thoughts on the change, which I think is beneficial to the module going forward.

(I hope everyone is doing well - haven't been around often enough to see new modules and some of the new progress on PW3; but getting there slowly.)

Update: I forgot to mention that FastRoute also allows for optional segments which allows us to jump from, say, /page.php?parent={parent}[&child={child}] to either, say, /{parent}/{child}/ or /{parent}/, depending on the input. Sure, I don't see a wide variety of use-cases for this feature, but I'm sure it'll come in handy to some.

Edited by Mike Rockett
Changed default parameter type
  • Like 6
Link to comment
Share on other sites

Small update from my side: I'm busy testing all of this out in a simple PHP script that imports FastRoute - so far, so good!

For the purposes of better understanding and correct approach, I'd like to also change the mapping collection syntax from:

{variable_name|collection_name}

to:

{collection_name(variable_name)}

I did want to use square parenthises, but I'd like to try and not conflict with FastRoute's optional params.
(Edit: Sorry, my mistake - FastRoute has nothing to do with destinations. I might switch back to pipes anyway... Not sure I like this format.)

Thoughts?

 

Update: Here's some testing output at the current stage:

Request URI: string(25) "/page.php?id=2&category=1"

Matched Jumplink Object: object(stdClass)#2 (2) {
  ["from"]=>
  string(47) "/page.php?id={page:\d+}&category={category:\d+}"
  ["to"]=>
  string(41) "/{categories(category)}/{page_ids(page)}/"
}

Captured Parameters: array(2) {
  ["page"]=>
  string(1) "2"
  ["category"]=>
  string(1) "1"
}

Identified Collection Item from page_ids: array(1) {
  [2]=>
  string(8) "about-us"
}

Identified Collection Item from categories: array(1) {
  [1]=>
  string(7) "company"
}

Compiled Destination: string(18) "/company/about-us/"

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...