It is extremely useful to be able to add placeholders to the Title.

For example: the user could set "my special title | %site_name" as the Title.

This patch adds: %page_title (although I prefer %node_title), %site_name, and %site_slogan.

Comments

johnalbin’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
StatusFileSize
new1.74 KB

Here's the patch for 5.x-1.x-dev.

johnalbin’s picture

Title: Allow placeholders in title » Allow placeholders in title (Token integration)

Since creating this patch, I’ve since become aware of the Token module which, if page_title supported it, would allow users to use tokens (placeholders) from many different sources. And not just 3 tokens I have in my patch.

When I have time, I will look at Token integration. If anyone is going to try tackling it, please contact me and we can collaborate.

johnalbin’s picture

Status: Needs review » Active

The above patch might be useful to some people as an interim solution, but it shouldn’t be incorporated in page_title.

Token integration is the way to go.

nicholasthompson’s picture

That CERTAINLY looks a like an interesting option!

My only concern is that by integrating it with the Token Module means that this module is no longer a standalone. It has a dependancy of Token module. Now is you just want to control page title's but using node title then this turns Page_Title into quite a bloated install.

Made there should be a page_title_lite and a page_title_token as seperate projects?

johnalbin’s picture

I was thinking that Token module support should be optional via the module_exists() check. So that only people who need the functionality (many people, but not everyone) can optionally get it.

nicholasthompson’s picture

Ahhh cunning!

alliax’s picture

Hi, at which stage are you with this feature? It's the most missing one regarding drupal and SEO, especially working with pathauto for the URL, we can have book path or vocabulary path, but then we don't have it in the page title, it's a pity.
Same could be said about the METATAGS module, it would greatly benefit from an integration with TOKEN module.

jaydub’s picture

Status: Active » Needs review
StatusFileSize
new4.17 KB

I took a stab at integration Token in the attached patch.

Note that the patch includes a few other changes, mostly cosmetic, to the page_title module. Also I added a function in the API section to be able to set the page_title directly from another module (as is my need at the moment).

This is quick and dirty but seems to work for now. Please test out and let me know of issues.

Right now this just allows for setting of page titles for nodes based on Token patterns. Possible future updates could includes setting of taxonomy, etc.

jaydub’s picture

StatusFileSize
new424 bytes

page_title.info patch to add Token module dependency.

I would like to add that I looked at the autonodetitle module for help on how to use Token.

johnalbin’s picture

Version: 5.x-1.x-dev » 5.x-2.x-dev
summit’s picture

Hi,

Will this patch be submitted to 2.x-dev, or is it allready submitted?
Sorry, it is not clear to me.

Thanks in advance!
greetings,
Martijn

johnalbin’s picture

Status: Needs review » Needs work

Jeff’s patch does the token replacement before inserting into the database (as the autonodetitle module does.)

I’m working on adding token integration that does the token replacement before the title is displayed, so that if a token’s value changes over time, the title will change. Also, I want the token integration to be optional, and not a required dependency.

My work isn’t complete, but will be incorporated into 5.x-2.x.

nicholasthompson’s picture

Version: 5.x-2.x-dev » 5.x-2.0-alpha1
Assigned: Unassigned » nicholasthompson
Status: Needs work » Fixed

Token integration as of DRUPAL-5--2-0-ALPHA1 addresses this issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)