Go to page content

Multiple blogs in a site

Supporting multiple member blogs.


Suppose you have a social or membership site with the following members: Marc, Arjan, Alain, Michael. How can you give each member his own personal blog on your site?


Readers are expected to be familiar with dispatch rules, Zotonic templates, the Zotonic CMS admin interface and the UNIX command-line.



  1. Create the category Member_Blog
  2. For each member, create the subcategory
  3. NOTE: These category names are arbitrary. Modifiy to suit your need.

Dispatch rules

  1. For each member, add the following dispatch rules to .../priv/sites/dispatch/dispatch :
{<membername>_home, ["<membername>"], resource_page, [ {template, "<membername>_home.tpl"}, {id, i<membername>_home} ]},
{<membername>, ["<membername>", id, slug], resource_page, [ {template, "<membername>.tpl"}, {cat, <membername>} ]},
{<membername>, ["<membername>", id], resource_page, [ {template, "<membername>.tpl"}, {cat, <membername>} ]},


  1. Copy the following template from .../zotonic/priv/sites/default/templates into your sites:

    cp _article_prevnext.tpl /home/zotonic/zotonic/priv/sites/<yoursite>/templates/_blog_prevnext.tpl
  2. For each member, copy the following templates from .../zotonic/priv/sites/default/templates into your sites:

    cp home.tpl /home/zotonic/zotonic/priv/sites/<yoursite>/templates/<membername>_home.tpl
    cp article.tpl /home/zotonic/zotonic/priv/sites/<yoursite>/templates/<membername>.tpl
  3. Modify each version of .../ /templates/ _home.tpl as follows:

    a) Under {% block content %} add:

    <h1><blog title</h1>
    <h2><blog subtitle></h2> 
    <br /> 

    b) Change the following line:

    {% with m.search.paged[{query cat='article' sort='-publication_start' pagelen=m.config.site.pagelen.value page=q.page}] as result %}


    {% with m.search.paged[{query cat=id.category sort='-publication_start' pagelen=m.config.site.pagelen.value page=q.page}] as result %}

    c) close the new {% with... clause:

    Under: {% endwith %}
    Add: {% endwith %}
    and save.

  4. Change the include in _blog_prevnext.tpl . You may wish to add a signature line to each .tpl

    a) Change the following line:

    {% include "_article_prevnext.tpl" id=id %}


    {% include "_blog__prevnext.tpl" id=id %}

    a) Under {{ id.body|show_media }} add:

    <br />

    and save.

  5. Modify .../templates/__blog_prevnext.tpl as follows:

    Modify all references:




    and save.

Blog home pages

  1. For each , make a blog home page:

    a) Select Page from admin menu

    b) Select category

    c) Insert title, summary, copy

    d) Give it the Unique name _home

    NOTE: This step is very important. Easy to forget.

    e) select Published

    f) and save

    g) Repeat for each

  2. You should now be able access 's blog:


    If it doesn't work double check your categories, dispatch rules, templates, and blog home pages.

  3. The only thing left is to hook your blogs into a menu in your site

    a) Select Menu from the admin page

    b) Select your blog home page

    c) Drag it over into your menu

    d) Repeat for each blog

    No doubt this procedure can be improved or streamlined. But unless I mistranscribed or mistyped something, it works.


There are no troubleshooting steps available for this guide.  Please provide any you have learned in the comments below or on the Zotonic Users Group.

This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.