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

Ivan Sergio Borgonovo mail at webthatworks.it
Tue May 5 16:19:07 UTC 2009

I was looking at nodewords (aka Meta tags) and I developed my own
mini module to push stuff into <head>.

nodewords grab informations from "core" or very popular modules to
add stuff into meta and it provides a basic api to other modules.

But somehow meta are a standard part of a web page and drupal
provide just drupal add_html_head/drupal_get_html_head.

So there is no way to edit in a structured way head.

A common use would be to add keywords or replace them and support
keywords/description for content that is not node-based.

If there was such a structured object to deal with META it would be
easier for modules and non-node content to place stuff there.
And in spite of writing an "additional" snippet of code to
nodewords to support different modules, other modules will just have
to pass what they want to this object.

I already wrote a module that provide such object to give a
structured access to HEAD and provide some helper to easily access,
overwrite, add description, keywords and canonical url + support for
nearly arbitrary head tags.

I`m going to build up a nodewords clone to experiment with an hybrid
approach that will offer modules to push stuff into HEAD and pull
stuff from core object as nodewords already does.
Of course I already have some other module that push stuff into meta.

There could be a head_alter hook or something similar.

I was wondering if a more structured access to HEAD would gain any
traction in core or there is already someone working on it to get an
idea of the direction core may take.


Ivan Sergio Borgonovo

More information about the development mailing list