As a co-maintainer (and soon to be owner) of Title Rewrite, I propose we merge modules.

Title Rewrite changes the page title based on path, not node type, and rules are evaluated by weight. This allows custom titles on any page, not just nodes. Perhaps path-based titling can be added as a separate tab in the Page Title interface, with a default rule that handles per-node-type and per-node titling rules? This would allow proper weighting of node-type-, node-, and path-based rules.

Note that Title Rewrite is available only for Drupal 5.x.

Comments

I think this is an excellent idea.

I wrote a patch a while ago which did this... Not sure where it went now (or if its even worth updating for the current codebase changes!).

Currently you can set page titles for nodes, terms & users. You can set page title "patterns" for individual node types, term vocabularie, user profiles, blog homepages, frontpage and finally a "fallback" default pattern.

I'm not sure how we'd implement "weighted rules" in anyway which could help... But what would be AWESOME is to allow users to specify custom URL patterns and bind them to page title patterns... For example, you could create a custom view. This view could take URL-based arguments. These URL based arguments could change the scope of the URL... For example my-view/[uid]/[termid]. If you provided just arg(0) then the page title can only be in the "global scope", however if the uid was then passed we suddenly have access to a new bunch of tokens as we have access to the user scope. If the term ID is also passed, we have access to global, user and taxonomy scopes for tokens.

If you want to help me work on this - I'd be VERY happy for this. :)

Cheers,
Nick

Nicholas: Thanks for the reply. I would very much like your help, actually, as I don't have much time at all to work on this.

Weighted rules will become necessary very quickly if we expand Page Title to include custom URL patterns. Say a user wanted title patterns for both my/url/* and my/url/is/longer/*. She would need to control the order in which those patterns were processed; otherwise, the titles for my/url/is/longer/* would be overwritten by those for my/url/* should the second pattern be run later.

Because Page Title includes node-level and custom front page titles, I suggest adding those rules as items in the weighting UI. Perhaps the front page title would be frozen in place so that it's always run last? Maybe do the same for node-level custom titles. I think it's safe to assume that adding a custom title to a node should override any path-based rules set elsewhere. However, since the front page could be a node, the front page title should override the node-level title.

Have you seen the way the menu system matches paths with wildcards? It uses a binary scoring system... Any non match fails the check. Any wildcard scores 0. Any exact match scores a "power of 2" working from the right... It's a little hard to explain ad I'm writing this on my iPhone... By imagine this.
URL: node/123/foo/bar

path: node/%/foo/%/%

There are 5 args so the cols are assigned scores of 16, 8, 4, 2 & 1 respectively... However 3 cols are wildcard. The means the total is 16+4.. or 20.

The more col matches the higher the score. You should also find unique matching paths should score distinct scores...

I think this is right... ;-) if so it should alieviate the need for a weighting system.

Status:Active» Postponed

Title:Merge with Title RewriteSpecific path matching Page Titles
Version:6.x-2.x-dev» 7.x-2.x-dev
Status:Postponed» Needs work

Specific path matching for Page Titles should be a feature in the 2.5 release...

@nicholasThompson,

Hmm... I am confused by your last comment. I initially read this as the feature will be in the 2.5 release but took note of the "needs work" status. I don't currently see anything in the 2.5 or latest 2.x-dev releases related to this. I also don't see a patch that needs work. Have you began working on this already or is this an active issue waiting for someone to take it on?

Status:Needs work» Needs review
StatusFileSize
new23.95 KB

I have attached a patch that created a Page Title Path submodule as a starting point. It was largely derived from the redirect and metatags_quick modules.

Priority:Normal» Major

@AntoineSolutions - you are correct, I didn't included it and my relpy could have been worded better.

This is still on my to-do list. That patch looks like a great start. I need to allocate some time to review it.

StatusFileSize
new24.04 KB

Hey all
I put in a few fixes for warnings in this patch. Also, this patch uses page_title based on the path of menu_get_item() of the current page.
What that means is that for taxonomy term pages - this is taxonomy/term/% - hence it becomes useless in case you wanted to customize the page title of different term pages for example.
This patch changes it to use the page titles based on the $_SERVER['REQUEST_URI'] - making it more useful IMO.

Hi gargsuchi, your patch didn't seem to work for me. I added a few path-based page titles but none of them shows. Am I missing anything?

@abtm - can there be any other module which is over riding the page titles?