Commit 31be6598 authored by Will LaShell's avatar Will LaShell
Browse files

Fix to show seo fields if present.

parent c126038d
......@@ -59,6 +59,12 @@ def site_page(request, url, extra_context=None):
if sitepage.login_required and not request.user.is_authenticated():
return redirect_to_login(request.path)
# FIXME: This should evaluated for better handling
if getattr(request, 'site_seo', False):
sitepage.title = request.site_seo['seo_title']
sitepage.meta_keywords = request.site_seo['seo_keywords']
sitepage.meta_description = request.site_seo['seo_description']
context_dict = {'sitepage': sitepage, 'request_path': request.path}
if extra_context:
context_dict = dict(context_dict, **extra_context)
......@@ -4,7 +4,7 @@ from django.core.cache import cache
from site_seo.settings import ENABLED, COLLECT_404
from site_seo.common import add_404_url
from site_seo.models import SiteUrl
from site_seo.models import SiteUrl, SiteUrlDefaults
class SiteSeoMiddleware(object):
......@@ -23,8 +23,15 @@ class SiteSeoMiddleware(object):
siteurl = SiteUrl.objects.get(site=current_site, url=url)
except SiteUrl.DoesNotExist:
siteurl = SiteUrl()
siteurl = SiteUrlDefaults.objects.get(site=current_site)
except SiteUrlDefaults.DoesNotExist:
siteurl = SiteUrl(page_title='',
request.site_seo = {'seo_title': siteurl.page_title,
'seo_keywords': siteurl.page_keywords,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment