Hi there!
I can post {{ page.petition.signatures_count | number_with_commas }} on a petition page and it displays the total number of petition signers.
How do I change this variable so that I can display the petition count total on another page? Like, say, my about page?
Thank you!
Official response from NationBuilder Support
To learn more about displaying content from one page on another page, please take a look at our aptly named theme documentation: Display content from one page on another page
Share this post
Showing 6 reactions
Sign in with
For this reason, you should create a new file that starts with an underscore and ends with “.html”, so in my example, I’ll call it “_petition_total_count.html”. In that file, you would need to place the following code: {{ page.petition.signatures_count | number_with_commas }}
Then, if you wanted to display (on any page) the signatures_count of a petition page that has the slug “my_petition”, you would do so using this code:
{% subpage “my_petition” with “petition_total_count” %}
Let me know if you have questions about this!
At best the code I’ve tried ( {{ page.petition.signatures_count | number_with_commas }} with varying degrees of wrappers). displays nothing (or just prints the code). Even when copying the entire petitions page code onto the homepage template it shows the petition form, but not the number of petitions signed.
It would be great to have this number as part of a dynamic call to action on our homepage for viewers to see and engage right from the beginning.
Hines Digital
Certified Architect
Certified Expert
Tim Wayne
Certified Architect
Certified Expert
{% for post in page.petition.signatures_count limit:3 offset:0 }
<div style=“font-weight: bold; font-size: 16px;”>{{ page.petition.signatures_count | number_with_commas }}</div>
{ endfor %}
Then on my page where I wanted the count displayed, I put this tag: <h2>Total number of petition signers: {% subpage “petition” with “petition_count” %}</h2>
However, nothing shows up. (see About page linked above).
I am missing a step. Something basic, I am sure of it, but I’m not sure where I can find the answer.
Tim Wayne
Certified Architect
Certified Expert