"""
pagetitle.py pyblosxom plugin
Sets the page title appropriately if there is only one entry in view.
pagetitle.py adds a new variable which will contain the standard
'blog_title_with_path' page title, unless there is only one entry in
view. If there is only one entry in view, the page title is augmented
with the story title aswell. This makes search engine results and
browsers happier, as they can recognize what your page is about by
the title!
The new variable you want to use is:
$blog_title_or_entry_title
ie:
$blog_title_or_entry_title
CONFIGURATION
In config.py, add:
py['pagetitle_variable'] = "blog_title_with_path"
or whatever $variable you currently use for the page title.
"""
__author__ = 'Jordan Sissel '
__version__ = '20060711'
__url__ = 'http://www.semicomplete.com'
def cb_prepare(args):
request = args["request"]
config = request.getConfiguration()
data = request.getData()
if data.has_key("entry_list"):
if len(data["entry_list"]) == 1:
title = "%s :: %s" % (data["entry_list"][0].getMetadata('title'), config["blog_title"])
data["blog_title_or_entry_title"] = title
elif len(data["entry_list"]) > 1:
data["blog_title_or_entry_title"] = data[config["pagetitle_variable"]]