Make a forum

Forums are a great way to engage with your supporters and get their feedback on the issues that matter to them.

Updated over a week ago

Table of Contents

How a forum is structured

Forums are often structured in a “tree-like” directory. The homepage of the forum will have a lot of categories, each category will have user submitted posts, and each post will have comments.

Forums can be structured similarly on NationBuilder using a Basic page as the “forum page” and Suggestion Box pages as the “categories”.

This allows nation owners to control the various categories people are able to start conversations around, while also giving supporters the ability to post, comment, and engage with others. 

Make a forum

The implementation of a forum requires some knowledge of the liquid templating language to access our page level variables and objects. A common technical structure is outlined below;

1. Create a Basic page. This page will be the forum “homepage” that will store all the Suggestion Box pages (categories) as subpages.

2. On your Basic page, navigate to Subpages > New subpage. Create a Suggestion Box page for each of the “categories” you want in your forum. These need to be created as subpages so that all of your categories can be featured on the forum page.

3. Now that all of  the categories for the forum are created, custom liquid code will be needed to pull their details onto the forum page. So, go back to the Basic page from step one, and navigate to Template > Create a custom template.

4. In the custom template, locate the code {{ page.basic.content }} and replace it with this code:

{% for category in page.children %}
  <h3><a href="{{category.url}}">{{ category.headline }}</a></h3>
  {{ category.suggestion_box.content }}
  {% assign number = category.suggestion_box.most_recent_suggestions.size %}
  <em>{{ number }} post{% unless number == 1 %}s{% endunless %}</em>
{% endfor %}

This will pull across each of the suggestion box pages as categories, displaying their headline, description, and number of posts.

5. You can then customize the code further to add relevant styling, or edit the pages_show_suggestion_box.html and pages_show_suggestion.html theme files to suit your content/design needs for your forum.

Related HOWTOs

Did this answer your question?