6

I've been researching Mezzanine for some time now, but I haven't found much of tutorials beyond basic installation. Mezzanine docs contain information on how to customize Page models and adding new content types.

However, what I want to do is utilise existing content types (pages, blog posts) in different ways.

For example, I want to have custom "blog listing" page beyond basic default blog listing.

How do I even create that - second - blog page in the admin? How do I set it's template to my, custom template without touching default blog list template?

How do I therefore have 2 different blog listing pages?

tonino.j
  • 3,630
  • 25
  • 26

2 Answers2

5

Use the mezzanine.blog.models.BlogCategory model for your different blog lists. If you are not happy with 'category/' being in the path, you can copy and modify (below) the mezzanine.blog.urls to your project urls.py.

url("^%s(?P<category>.*)%s$" % _slashes,
    "mezzanine.blog.views.blog_post_list",
    name="blog_post_list_category")

To create category templates, take a look at the blog_post_list view and you will see:

templates.append(u"blog/blog_post_list_%s.html" %
                          unicode(category.slug))

To add a template for category "Foo", copy mezzanine/blog/templates/blog_post_list.html to your project templates/blog/blog_post_list_foo.html. The new template will render if you navigate to /blog/foo/.

ken
  • 1,003
  • 8
  • 14
0

Check out the series of blog posts on theming Mezzanine by Josh Cartmell. I've found this series to be extremely helpful in getting started with Mezzanine. MEZZaTHEMing (creating Mezzanine themes) Part 1: base.html.

andrewmo
  • 1,857
  • 1
  • 15
  • 19