1 from django.conf import settings
2 from blog.models import BlogEntry, BlogSection
5 def blog_feed(request):
7 'BLOG_FEED_ROOT': settings.BLOG_FEED_ROOT,
10 def content_breadcrumb(request):
12 if path[0:len(settings.BLOG_ROOT)] == settings.BLOG_ROOT:
13 breadcrumb = [{'url': u'/', 'title': u'Home'}, {'url': settings.BLOG_ROOT, 'title': u'Blog'},]
15 path = path[len(settings.BLOG_ROOT):]
17 parts = path.split('/')
19 if parts[0] == "section":
20 # Just need to add the section title to the breadcrumb *if* we
21 # actually have a section
24 section = BlogSection.objects.get(slug__exact=parts[1])
25 breadcrumb.append({'url': section.get_absolute_url(), 'title': section.title})
29 if len(parts) == 5 and \
30 parts[0].isdigit() and \
31 parts[1].isdigit() and \
33 # try getting the blog entry
35 entry = BlogEntry.objects.get(publish_date__year=int(parts[0]), publish_date__month=int(parts[1]), publish_date__day=int(parts[2]), slug__exact=parts[3])
36 breadcrumb.append({'url': entry.get_absolute_url(), 'title': entry.title})
38 breadcrumb.append({'url': 'nowhere', 'title': 'screwed'})
42 'content_breadcrumb': breadcrumb,