First off, I'm not sure where the "right" place to post this is, whether it's in Page Title, Token or Pathauto, BUT, I've been able to replicate the same problem, over several installs.
Assuming all three modules are installed: Page Title, Token & Pathauto
Assuming content type is: newpage
Assuming page title for a newpage node is: this is a new page!
I set the node pattern for a content type to: newpage/[page-title-raw] so the url alias will be pulled from the page title, instead of the node "heading" or node title.
When I create a node of the content type "newpage", plugin my page title and save the node for the first time, I get a URL alias of: /newpage/create-newpage instead of /newpage/this-is-a-new-page
Now, if I go back in and edit that same node, go to URL Path Settings, the "Automatic Alias" is unchecked. Once I check it and save the node, it creates the proper URL alias of: /newpage/this-is-a-new-page
Has anyone else experienced or been able to duplicate this? Also, is it a page title, token or pathauto issue?
Comment | File | Size | Author |
---|---|---|---|
#12 | page_title-node-1015130-12.patch | 1.37 KB | theunraveler |
Comments
Comment #1
philsward CreditAttribution: philsward commentedYeah, wow... I guess I forgot to set the version and what-not on this issue... The codebase for this is with Drupal 6.x, not 5.x. Changing to the 6.x version
Comment #2
TJEngel CreditAttribution: TJEngel commentedI am experiencing the exact same issue, although I am using the non-dev 6.x-2.3 version of Page Title. I have also been able to replicate the issue multiple times by performing the workflow outlined above. I am using the [page-title] replacement pattern in my PathAuto settings.
I am also unsure whether this is a Page Title, Path, PathAuto, or Token issue. Confirming that I am able to duplicate.
Comment #3
entrigan CreditAttribution: entrigan commentedLikewise. The issue is that token for page-title gets the node object by calling menu_get_object(), which is not a node if the page is node/add/*
To remedy this I have modified the page-title tokens as follows:
modify function function page_title_token_values() to add a token of type 'node'
Then modify the function page_title_get_title() as follows:
Sorry for not having a patch. This is most likely not a perfect fix, as I have never written token integration before I wrote this somewhat blindly. Perhaps there should be a different function to handle the node token? It however does work.
Comment #4
TJEngel CreditAttribution: TJEngel commentedentrigan, just wanted to say thanks and that this is an effective workaround. I am not enough of an expert to know if this would be considered a "best practices" fix, but able to confirm that yes, it does solve the issue.
Comment #5
entrigan CreditAttribution: entrigan commentedOk since we have not heard from maintainers, I have gone ahead and rolled this into a custom module. code is as follows: (middle function is not really necessary)
Comment #6
philsward CreditAttribution: philsward commentedSince I'm a programing idiot, I'm going to ask a bit of a dumb question here... Who exactly would be responsible for getting this fixed? The "Page Title" folks or the "Token" folks? If it's the token folks, I'll get a post going over in their queue.
Comment #7
entrigan CreditAttribution: entrigan commentedPage Title is responsible. Just needs to implement an additional token for node page titles.
Comment #8
ranavaibhavIssue persists in 7.x version as well. #5 doesn't seem to be valid for 7.x branch.
Echo initial post (Posted by philsward on January 4, 2011 at 7:00pm), however the token is: [current-page:page-title] for 7.x
Comment #9
jeffwidman CreditAttribution: jeffwidman commentedsubscribe
Comment #10
sillygwailoHere's the first stab at the Drupal 7 equivalent of #5 (which I'm grateful for in a D6 project).
Replace 'modulename' with the name of your custom module. Also make a note to update the token's description text so that you can find the code later when looking at it in an administrative interface. Most of the code is from core's node.tokens.inc.
Comment #11
nicholasThompsonSorry for not looking into this - I have been away from my issue queues recently as my wife and I have had a baby (which takes priority, I'm afraid! ;-) heh).
This is an interesting bug as I'd never expected people to use the Page Title for the URL. I guess it makes sense...
As you have also pointed out, the problem is that the token scope doesn't exist yet. I'll try running some tests against #1015130-3: Page Title Token Won't Create Pathauto URL Alias On First Save as it looks like a sensible enough solution. I sometimes wish Drupal had a better context detection system. ;-)
Comment #12
theunraveler CreditAttribution: theunraveler commentedHere's a patch for the D7 fix in #10, with a few additional improvements.
Comment #13
sillygwailoComment #14
interdruper CreditAttribution: interdruper commentedPatch #12 makes available a new token: [node:page-title] , and it works fine for me.
Now you can use the Page Title configurations in the Pathauto patterns.