From 55a3a94a8a012ddf06262e0e92dbcaf1f214ac0d Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 11 Jan 2014 09:25:24 +0000 Subject: [PATCH] better title for search engines --- pandora/item/views.py | 9 +++++++++ pandora/templates/item.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pandora/item/views.py b/pandora/item/views.py index f22018501..5933ffb55 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -1204,6 +1204,7 @@ def item_xml(request, id): def item(request, id): id = id.split('/')[0] + view = None template = 'index.html' level = settings.CONFIG['capabilities']['canSeeItem']['guest'] if not request.user.is_anonymous(): @@ -1242,6 +1243,13 @@ def item(request, id): clips.append(clip) clip = {'in': a.start, 'annotations': []} clip['annotations'].append(a.value) + head_title = u'%s – %s' % (settings.SITENAME, item.get('title', '')) + if item.get('director'): + head_title += u' (%s)' % u', '.join(item.get('director', [])) + if item.get('year'): + head_title += u' %s' % item.get('year') + if view: + head_title += u' – %s' % view ctx = { 'current_url': request.build_absolute_uri(request.get_full_path()), 'base_url': request.build_absolute_uri('/'), @@ -1252,6 +1260,7 @@ def item(request, id): 'clips': clips, 'icon': settings.CONFIG['user']['ui']['icons'] == 'frames' and 'icon' or 'poster', 'title': ox.decode_html(item.get('title', '')), + 'head_title': head_title, 'description': item.get_item_description() } if not settings.USE_IMDB: diff --git a/pandora/templates/item.html b/pandora/templates/item.html index bd1b5656a..d2cb23dad 100644 --- a/pandora/templates/item.html +++ b/pandora/templates/item.html @@ -2,7 +2,7 @@ - {{settings.SITENAME}} - {{title}} + {{head_title}}