Merge with Title Rewrite

Todd Nienkerk - June 7, 2009 - 03:05
Project:Page Title
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

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.

#1

nicholasThompson - June 11, 2009 - 10:33

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

#2

Todd Nienkerk - June 25, 2009 - 13:43

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.

#3

nicholasThompson - June 25, 2009 - 17:38

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.

#4

nicholasThompson - November 23, 2009 - 22:47
Status:active» postponed
 
 

Drupal is a registered trademark of Dries Buytaert.