diff options
-rw-r--r-- | askbot/templates/base.html | 9 | ||||
-rw-r--r-- | askbot/templates/meta/html_head_meta.html | 8 | ||||
-rw-r--r-- | askbot/tests/page_load_tests.py | 12 |
3 files changed, 20 insertions, 9 deletions
diff --git a/askbot/templates/base.html b/askbot/templates/base.html index eaf2261d..63d7115f 100644 --- a/askbot/templates/base.html +++ b/askbot/templates/base.html @@ -2,7 +2,14 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <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 }}" /> {% block before_css %}{% endblock %} {% include "meta/html_head_stylesheets.html" %} diff --git a/askbot/templates/meta/html_head_meta.html b/askbot/templates/meta/html_head_meta.html deleted file mode 100644 index 352ffb53..00000000 --- a/askbot/templates/meta/html_head_meta.html +++ /dev/null @@ -1,8 +0,0 @@ -<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 %} diff --git a/askbot/tests/page_load_tests.py b/askbot/tests/page_load_tests.py index 0f102975..293cb78d 100644 --- a/askbot/tests/page_load_tests.py +++ b/askbot/tests/page_load_tests.py @@ -9,6 +9,7 @@ from django.utils import simplejson import coffin import coffin.template +from bs4 import BeautifulSoup from askbot import models from askbot.utils.slug import slugify @@ -568,6 +569,17 @@ class AvatarTests(AskbotTestCase): ) +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): def setUp(self): |