Permalink
Browse files

fixed meta tags: should have absolute urls to images

  • Loading branch information...
janza committed Mar 9, 2014
1 parent b5a67d9 commit 56d386430d5a695d4c43f8a013def98ad6ff5223
Showing with 13 additions and 4 deletions.
  1. +9 −0 ctx.py
  2. +1 −1 kset/settings/base.py
  3. +1 −1 kset/templates/event.html
  4. +1 −1 kset/templates/events.html
  5. +1 −1 kset/templates/index.html
View
9 ctx.py
@@ -25,3 +25,12 @@ def header(request):
pass
return ctx
+
+
+def baseurl(request):
+ if request.is_secure():
+ scheme = 'https://'
+ else:
+ scheme = 'http://'
+
+ return {'BASE_URL': scheme + request.get_host(),}
View
@@ -75,7 +75,7 @@ def ABS_PATH(*args):
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS +\
('django.core.context_processors.request',
- 'ctx.header')
+ 'ctx.header', 'ctx.baseurl', )
def ensure_secret_key_file():
@@ -5,7 +5,7 @@
{% block extrahead %}
<meta property="og:title" content="{{ event.title }}" />
<meta property="og:description" content="{{ event.description|striptags|truncatechars:140 }}" />
-<meta property="og:image" content="{% if event.thumb %}{% version event.thumb 'medium' %}{% endif %}" />
+<meta property="og:image" content="{{ BASE_URL }}{% if event.thumb %}{% version event.thumb 'medium' %}{% endif %}" />
{% endblock %}
{% block leftcolumn %}
@@ -6,7 +6,7 @@
{% with events|first as event %}
<meta property="og:title" content="{{ event.title }}" />
<meta property="og:description" content="{{ event.description|striptags|truncatechars:140 }}" />
- <meta property="og:image" content="{% if event.thumb %}{% version event.thumb 'medium' %}{% endif %}" />
+ <meta property="og:image" content="{{ BASE_URL }}/{% if event.thumb %}{% version event.thumb 'medium' %}{% endif %}" />
{% endwith %}
{% endblock %}
@@ -6,7 +6,7 @@
<meta property="og:url" content="http://www.kset.org/" />
<meta property="og:title" content="www.KSET.org" />
<meta property="og:description" content="Klub Studenata Elektrotehnike" />
- <meta property="og:image" content="http://www.kset.org/{{ STATIC_URL }}frontend/images/kset_logo.png" />
+ <meta property="og:image" content="{{ BASE_URL }}{{ STATIC_URL }}frontend/images/kset_logo.png" />
<meta property="og:latitude" content="45.80154"/>
<meta property="og:longitude" content="15.97166"/>

0 comments on commit 56d3864

Please sign in to comment.