[development] global object to push stuff into <head>

Ivan Sergio Borgonovo mail at webthatworks.it
Wed May 6 02:02:27 UTC 2009


On Tue, 5 May 2009 11:41:47 -0500
Jeff Eaton <jeff at viapositiva.net> wrote:

> On May 5, 2009, at 11:19 AM, Ivan Sergio Borgonovo wrote:
> 
> > So there is no way to edit in a structured way head.
> 
> In Drupal 7, I'd really love to see the globally alterable $page
> array become a place where this stuff lives. hook_page_alter
> already exists...

OK... the method to write there is getting simpler and simpler but
there is still just a drupal_get_html_head in D7 too.

I`d say is just a matter of giving a more fine grained structure to
head.

Is there anything else worth to support other than:

META
http://www.w3.org/TR/REC-html40/struct/global.html#h-7.4.4
LINK 
http://www.w3.org/TR/html401/struct/links.html

rendering an arrays that represent the above shouldn`t be hard.

I think we can`t have a pure push or pull approach eg. for
description.
Taxonomy may decide to fill description but the administrator may
like to have a description formed by node title + taxonomy terms or
node title and publishing date etc...

Anyway having a more structured HEAD may help both push and pull
approach.

eg. a module that doesn`t produce nodes but just "pages" may decide
to push some content in the META description. An "arbitrator" as
nodewords may decide to pull from nodes and taxonomies (views
etc...) some information, mix it in the description.
Another module may act just before page rendering and concatenate
some more stuff to what the "arbitrator" did.

eg. "Lamborghini Countach in Cars » Sport Cars, hot topic"
title + taxonomy + added by module

Anyway accessing a standard array may help modules interact better.

Somehow my "home-brewed" module already offers a global object which
store an array and offer some methods to deal with the most common
operations on keywords and description and then, at least for D5 I
added some code in the page template.
In D6 I could use prerender hook.


-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



More information about the development mailing list