better title for search engines

This commit is contained in:
j 2014-01-11 09:25:24 +00:00
parent 7e07ff8fe6
commit 55a3a94a8a
2 changed files with 10 additions and 1 deletions

View file

@ -1204,6 +1204,7 @@ def item_xml(request, id):
def item(request, id): def item(request, id):
id = id.split('/')[0] id = id.split('/')[0]
view = None
template = 'index.html' template = 'index.html'
level = settings.CONFIG['capabilities']['canSeeItem']['guest'] level = settings.CONFIG['capabilities']['canSeeItem']['guest']
if not request.user.is_anonymous(): if not request.user.is_anonymous():
@ -1242,6 +1243,13 @@ def item(request, id):
clips.append(clip) clips.append(clip)
clip = {'in': a.start, 'annotations': []} clip = {'in': a.start, 'annotations': []}
clip['annotations'].append(a.value) 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 = { ctx = {
'current_url': request.build_absolute_uri(request.get_full_path()), 'current_url': request.build_absolute_uri(request.get_full_path()),
'base_url': request.build_absolute_uri('/'), 'base_url': request.build_absolute_uri('/'),
@ -1252,6 +1260,7 @@ def item(request, id):
'clips': clips, 'clips': clips,
'icon': settings.CONFIG['user']['ui']['icons'] == 'frames' and 'icon' or 'poster', 'icon': settings.CONFIG['user']['ui']['icons'] == 'frames' and 'icon' or 'poster',
'title': ox.decode_html(item.get('title', '')), 'title': ox.decode_html(item.get('title', '')),
'head_title': head_title,
'description': item.get_item_description() 'description': item.get_item_description()
} }
if not settings.USE_IMDB: if not settings.USE_IMDB:

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>{{settings.SITENAME}} - {{title}}</title> <title>{{head_title}}</title>
<link rel="icon" type="image/png" href="/static/png/icon.png" /> <link rel="icon" type="image/png" href="/static/png/icon.png" />
<meta name="application-name" content="{{settings.SITENAME}}"/> <meta name="application-name" content="{{settings.SITENAME}}"/>
<meta name="application-url" content="{{base_url}}"/> <meta name="application-url" content="{{base_url}}"/>