X-Git-Url: https://git.sommitrealweird.co.uk/sommitrealweird.git/blobdiff_plain/00841ead95c71fd168213f276dd10c717b7bdb00..3c8f423203be690dd0bda32e90eec49f1650e4c6:/sommitrealweird/blog/context_processors.py?ds=inline diff --git a/sommitrealweird/blog/context_processors.py b/sommitrealweird/blog/context_processors.py index e63a85f..9505bb9 100644 --- a/sommitrealweird/blog/context_processors.py +++ b/sommitrealweird/blog/context_processors.py @@ -2,19 +2,29 @@ from django.conf import settings from blog.models import BlogEntry, BlogSection import re +def blog_feed(request): + return { + 'BLOG_FEED_ROOT': settings.BLOG_FEED_ROOT, + } + def content_breadcrumb(request): path = request.path if path[0:len(settings.BLOG_ROOT)] == settings.BLOG_ROOT: - breadcrumb = [{'url': u'/', 'title': u'Home'}, {'url': settings.BLOG_ROOT, 'title': u'blog'},] + breadcrumb = [{'url': u'/', 'title': u'Home'}, {'url': settings.BLOG_ROOT, 'title': u'Blog'},] path = path[len(settings.BLOG_ROOT):] parts = path.split('/') if parts[0] == "section": - # Just need to add the section title to the breadcrumb - section = BlogSection.objects.get(slug__exact=parts[1]) - breadcrumb.append({'url': section.get_absolute_url(), 'title': section.title}) + # Just need to add the section title to the breadcrumb *if* we + # actually have a section + if len(parts) > 1: + try: + section = BlogSection.objects.get(slug__exact=parts[1]) + breadcrumb.append({'url': section.get_absolute_url(), 'title': section.title}) + except: + pass if len(parts) == 5 and \ parts[0].isdigit() and \