The NationBuilder stock themes include an email signup form in the header, footer and sidebar by default for users that are not logged in. The idea behind this is that it makes it very easy for new visitors to sign up to your email list with very little effort. People signing up via this box will not be tagged in any particular way, nor will they be put on a path, sent an auto-response email or assigned a point person. This is because the HTML code responsible for this form is inserted into the page using the 'include' method instead of the 'subpage' method.
If you would like to apply a tag, path, point person or autoresponse email to anyone who signs up through this form, you can do so by modifying the code in your custom theme so that it uses the 'subpage' method instead. After doing so, the form will reflect all of the settings configured on the default signup page in your nation.
After making sure that you are using a custom theme, navigate the "Layout.html" file to find the spot where the email form is being pulled into the header and the footer. In the screenshot below, we can see the email signup form being pulled into the header via the code on line 76. In this particular theme, the same code is being applied to the footer on line 135. Changing the code here (per the red text in the screenshot) will cause the form to appear just as it did before, but it will now reflect the settings configured on your default signup page, which you can identify and define by going to Site > Pages > Defaults.
To make this change to the field that shows up in the sidebar on some themes, you can make the same edit to the "_columns_2.html" file in your theme.
Optional modifications:
More fields: If you would like to add additional fields to this form, you can do so by editing the "_signup_form.html" file in your custom theme. You can add additional signup fields based on the variables of the Signup object.
Different page: If you would like to have this form reflect the settings of a signup page that is NOT your default signup page, you can do so by changing the page that this liquid code refers to. So instead of {% subpage site.signup_page with 'signup_form' %} , you could use {% subpage 'email_signup_page' with 'signup_form' %} . This would mean that the form would inherit the page settings of the page with the slug 'email_signup_page'.
Showing 7 reactions
Sign in with
However, if you are referring to the form in the header, I recommend using a liquid “IF/THEN” statement in your Layout.html file where the code for this form is stored. If the page that it is appearing on is a signup page, you can just ‘include’ the form, but if it is a different page then you’ll want to subpage the form with a different page, depending on the slug of the current page. In other words, you can have many different signup pages in your nation and a different one can be used as the ‘reference page’ for the form in the header depending on the slug of the page that is being viewed.
Here’s more on the subpage method: http://nationbuilder.com/theme_documentation#display_content_from_one_page_on_another_page
And here’s more on how to use Liquid IF/THEN statements: http://nationbuilder.com/liquid_basics
EXAMPLE:
Original: {% include “signup_form” with site.signup_page %}
Updated: {% if page.type_name == “Signup” %} {% include “signup_form” %} {% elsif page.slug == “Example” %} {% subpage “example_signup” with “signup_form” %} {% elsif page.slug == “Issues” %} {% subpage “issues_signup” with “signup_form” %} {% elsif page.slug == “About” %} {% subpage “homepage_signup” with “signup_form” %} {% else %} {% subpage “other_signup” with “signup_form” %} {% endif %}
Shoot us an email at [email protected] if you are still having trouble with this.
For example, we have a main page and a sub-page off our main that is for a particular action we have going on for the next three months. If you sign up via this action page, I would like to automatically add a tag telling me that is where you did so instead of just being in the main database. Is this possible to do?