From: jordan Date: Sun, 31 Jul 2011 17:00:47 +0000 (+0000) Subject: Jira OSQA-528, display the tag name in the meta description on the tag view, extendin... X-Git-Tag: live~174 X-Git-Url: https://git.openstreetmap.org/osqa.git/commitdiff_plain/ecdd91c7d9c3530c3febe8ffaf6175221bdc999e Jira OSQA-528, display the tag name in the meta description on the tag view, extending the context passed by the tag view git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1139 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/skins/default/templates/questions.html b/forum/skins/default/templates/questions.html index 8d4ee0a..6b9e0a3 100644 --- a/forum/skins/default/templates/questions.html +++ b/forum/skins/default/templates/questions.html @@ -7,6 +7,12 @@ {% block title %}{% spaceless %}{{ page_title }}{% endspaceless %}{% endblock %} +{% block metadescription %}{% spaceless %} + {% if tag %} + {% blocktrans with settings.APP_TITLE as app_title %}Questions and answers about {{ tag }} on {{ app_title }}{% endblocktrans %} + {% endif %} +{% endspaceless %}{% endblock %} + {% block meta %} {% endblock %} diff --git a/forum/views/readers.py b/forum/views/readers.py index d757e51..a16712e 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -113,13 +113,24 @@ def tag(request, tag): except User.DoesNotExist: raise Http404 - return question_list(request, + # The extra tag context we need to pass + tag_context = { + 'tag' : tag, + } + + # The context returned by the question_list function, contains info about the questions + question_context = question_list(request, questions, mark_safe(_(u'questions tagged %(tag)s') % {'tag': tag}), None, mark_safe(_(u'Questions Tagged With %(tag)s') % {'tag': tag}), False) + # Create the combined context + context = dict(question_context, **tag_context) + + return context + @decorators.render('questions.html', 'questions', tabbed=False) def user_questions(request, mode, user, slug): user = get_object_or_404(User, id=user) @@ -185,16 +196,19 @@ def question_list(request, initial, feed_url = request.path + "?type=rss" + req_params - return pagination.paginated(request, ('questions', paginator_context or QuestionListPaginatorContext()), { - "questions" : questions.distinct(), - "questions_count" : questions.count(), - "keywords" : keywords, - "list_description": list_description, - "base_path" : base_path, - "page_title" : page_title, - "tab" : "questions", - 'feed_url': feed_url, - }) + context = { + 'questions' : questions.distinct(), + 'questions_count' : questions.count(), + 'keywords' : keywords, + 'list_description': list_description, + 'base_path' : base_path, + 'page_title' : page_title, + 'tab' : 'questions', + 'feed_url': feed_url, + } + + return pagination.paginated(request, + ('questions', paginator_context or QuestionListPaginatorContext()), context) def search(request):