carpentries / tnd-carpentries-working

The Carpentries new website BEFORE the Hugo theme was packaged out. Not currently maintained.
https://tnd-carpentries-website.netlify.app/
0 stars 0 forks source link

Option to dynamically generate statistics #30

Closed maneesha closed 5 months ago

maneesha commented 5 months ago

When we use these bubbles with stats in them, we want to be able to dynamically generate these numbers. For example, the number of countries may be the number of unique countries in this feed. The number of workshops may be the length of the same feed. The number of members may be the length of this feed.

image

From what I can tell, this can be done in shortcodes which are then used in content pages, but not directly in content pages. Is this correct?

AdamChlan commented 5 months ago

@maneesha We did some testing on our end and the following code will allow you to set a site parameter, and output it:

{{< param "param_handle_here" >}}

This would be our recommended path for setting those number, rather than counting from the feed.

maneesha commented 5 months ago

Thanks. Is there a way we can have live/dynamic stats? These numbers will change regularly.

regisphilibert commented 5 months ago

Can you detail where the numbers would come from for each stat?

maneesha commented 5 months ago

As noted above:

For example, the number of countries may be the number of unique countries in this feed. The number of workshops may be the length of the same feed. The number of members may be the length of this feed.

If it is difficult to do the counts in building the site, we could add a feed for counts and then the site would just have to pull that.

regisphilibert commented 5 months ago

Oh I'm sorry I did not read that properly. But yes a feed for count would be the best way to go so we can build a shortcode which just pick the count set through a parameter.

So if you need a new count, you could update the feed on your site, and use the new parameter.

regisphilibert commented 5 months ago

I added the label Needs Client Feedback as this will become actionable once the new feed is created.

maneesha commented 5 months ago

As a prototype, can we use the n_trainers and n_instructors values from this feed?

regisphilibert commented 5 months ago

@maneesha I've implemented a feed_value shortcode. You can find it demonstrated on the module page here https://carpentries.netlify.app/modules/#feed-value. You can use int from within a the stat shortcode as well as demonstrated here: https://carpentries.netlify.app/modules/#blobs

maneesha commented 5 months ago

This all looks good.