Skip to content

Commit

Permalink
fixed the meta description tag for the question pages
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenyfadeev committed Sep 26, 2012
1 parent 1fb8a77 commit 56f56f2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
9 changes: 8 additions & 1 deletion askbot/templates/base.html
Expand Up @@ -2,7 +2,14 @@
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title> <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title>
{% include "meta/html_head_meta.html" %} <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
{% block meta_description %}
<meta name="description" content="{{settings.APP_DESCRIPTION|escape}}" />
{% endblock %}
<meta name="keywords" content="{%block keywords%}{%endblock%},{{settings.APP_KEYWORDS|escape}}" />
{% if settings.GOOGLE_SITEMAP_CODE %}
<meta name="google-site-verification" content="{{settings.GOOGLE_SITEMAP_CODE}}" />
{% endif %}
<link rel="shortcut icon" href="{{ settings.SITE_FAVICON|media }}" /> <link rel="shortcut icon" href="{{ settings.SITE_FAVICON|media }}" />
{% block before_css %}{% endblock %} {% block before_css %}{% endblock %}
{% include "meta/html_head_stylesheets.html" %} {% include "meta/html_head_stylesheets.html" %}
Expand Down
8 changes: 0 additions & 8 deletions askbot/templates/meta/html_head_meta.html

This file was deleted.

12 changes: 12 additions & 0 deletions askbot/tests/page_load_tests.py
Expand Up @@ -9,6 +9,7 @@


import coffin import coffin
import coffin.template import coffin.template
from bs4 import BeautifulSoup


from askbot import models from askbot import models
from askbot.utils.slug import slugify from askbot.utils.slug import slugify
Expand Down Expand Up @@ -568,6 +569,17 @@ def test_avatar_for_two_word_user_works(self):
) )




class QuestionViewTests(AskbotTestCase):
def test_meta_description_has_question_summary(self):
user = self.create_user('user')
text = 'this is a question'
question = self.post_question(user=user, body_text=text)
response = self.client.get(question.get_absolute_url())
soup = BeautifulSoup(response.content)
meta_descr = soup.find_all('meta', attrs={'name': 'description'})[0]
self.assertTrue(text in meta_descr.attrs['content'])


class QuestionPageRedirectTests(AskbotTestCase): class QuestionPageRedirectTests(AskbotTestCase):


def setUp(self): def setUp(self):
Expand Down

0 comments on commit 56f56f2

Please sign in to comment.