With Pathauto there is, in my knowledge, no way of knowing what the auto-generated URL is going to be before a user submits a node with pathauto enabled. Of course there is this link to show the pathauto settings, but no hints on the page itself. I often find myself uncertain if the URL for the node is going to be generated properly, as I want it to.

It would be a great gain if the URL that is to be generated is shown to the user before the node is submitted. I understand that this might bring a whole lot of client-side coding. If this is not wanted, an alternative can be to show the structure that applies for the node-type you are creating a node for, instead of the URL itself.

I am planning building a site that allows lots of users to add nodes, and I want to show them this structural information about the URL so they understand the url structure and learn about the site structure, and not create random urls. Giving them this kind of information would help keeping this site nice and clean.

I have included an image with two possible solutions for the User Interface. I hope this is a good addition to this great module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

I'm all +1 for this change. I actually had this as a part of #752034: Allow the Pathauto form altering to be re-usable. Not sure if I should merge these two issues or keep them separate.

sanderc’s picture

I don't think the two should be merged. The one you mention is far more about developing, where I approach this issue as an User Interface enhancement. It could really benefit the module for it makes it easier to use and better to understand for every Drupal user, as not every role is authorized to see the pathauto settings page to look up the pathauto setting for the node-type (did I mention that?).

Sorry. I'm a UX guy, more than a developer, so I advocate for that ;-).Which option of my attached image do you like best? I can imagine that the bottom one is more interfering with how Drupal works, as it is entered in the text field. But in my opinion, it's the cleanest solution from a user point of view.

Dave Reid’s picture

Putting the value in the field itself is probably not a good option as that can mess with the actual form processing or user input. The linked issue I provided change the 'Automatic alias' checkbox description to say something like "An alias will be generated for you using the pattern blog/[year]-[month]-[day]/[title]. If you wish to create your own alias below, uncheck this option."

sanderc’s picture

Great! Any chance this makes it into the module itself or do I have to use the patch instead? I don't have that much experience using patches.

klonos’s picture

Wouldn't it be great though if the actual path to be created was available in the field for the user to be able to edit/alter it if they desired so? ... I mean once they've unchecked the checkbox. Instead now, the field is left blank and the user might have to retype things.

Dave Reid’s picture

@klonos: Having a live preview of the url alias to be generated is *way* more complex than you think. :)

greggles’s picture

I think it's more interesting to show what the alias will be as the user posts things.

That's how Wordpress3.0 does it and it seems pretty useful. We could just attach a blur event to all elements on the page and update the alias based on what they've entered so far.

Freso’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Active » Needs review
Issue tags: +user experience
FileSize
891 bytes

I ripped this off from Dave's patch in the other issue, but I think this should do, right? I haven't tested it.

Freso’s picture

I think it's more interesting to show what the alias will be as the user posts things.

It certainly is, but it's also a bigger job, and until that's done, just seeing the structure of it is an improvement.

Status: Needs review » Needs work

The last submitted patch, 828038-preview-pathauto-structure-08-d7.patch, failed testing.

klonos’s picture

@Dave #6: ... I am sure it is. I haven't started coding drupal modules or getting familiar with the APIs etc (not yet). I am all 'it would be nice this' and 'it would be great that' here ;)

I was not talking about the token generated part of the url and I am pretty sure I've seen a type-something-in-a-field-see-it-update-live-in-another done someplace around the net. So, I guess it can be done with the page title field and the auto-url field too.

@greggles: I agree with Freso in #9

Dave Reid’s picture

Issue tags: -user experience

That's because wordpress's clean urls are a lot simpler. How do we handle a an alias that uses certain fieldss that a user role doesn't have access to? We can probably base some of the work off the Live modules which passes the values and through the ajax request builds a full node. Either way, please file a separate issue. This issue should remain about previewing the structure.

greggles’s picture

fwiw, I don't like the idea of showing the structure. Tokens are a developer/site builder concept that we shouldn't expose to end users.

klonos’s picture

@Dave: done... #844944: Live preview of what the URL will be in the field.

@greggles & Freso: ok, I was under the impression that we were talking about the 'live' preview and not exposing things that the user shouldn't see. /that's me switching sides to support greggles point of view/ ;)

sanderc’s picture

I think this discussion is about previewing the actual URL, as well as displaying the token-structure. This would be the second-best option.

@greggles: I agree that showing just the structure with tokens isn't the best solution and yes, it is developer/site builder minded, but it's better than not showing anything at all.

@Dave Reid: I understand it is a big job to display the generated URL live in the page, however, would it not be doable to define the structured URL on page load and then update the structured URL with onBlur as greggles suggests in #7?

@Dave Reid #12: Can you tell more about what it takes to check if users have access to a specified field? I'm not suggesting to let the user specify his own URL out of tokens on the page, so I guess the user already has access to the tokens he uses to build the URL, am I right?