jekyll-webmention_io icon indicating copy to clipboard operation
jekyll-webmention_io copied to clipboard

have filters to get numbers ?

Open maxandersen opened this issue 6 years ago • 5 comments

For now the only way I found to get the actual number of mentions to use them for logic is something like this:

 {% capture wbmcount %}{% webmention_count page.url %}{% endcapture %}
          {% assign wbmcount = wbmcount | remove: '<span class="webmention-count">' | remove: "</span>" |  times:1 %}
          {% if wbmcount > 0 %}
        ...

Thats quite tedious - it would be great if you could do something like:

{{ wbmcount = page.url | webmention_count }}

i.e. have filters operating on page.url to return the various values.

maxandersen avatar Dec 26 '18 09:12 maxandersen

Have you tried overriding the default count template like in this example? The count comes in as a liquid variable there, which (I think) should enable you to do whatever you want with it.

aarongustafson avatar Jan 02 '19 22:01 aarongustafson

that is what I ended up with doing but I still have to go through the "dance" of calling | times:1 on the value as its still considered a string.

maxandersen avatar Jan 02 '19 22:01 maxandersen

Ok. I'm not sure if a tag can return anything anything other than a string, but I'll look into it.

aarongustafson avatar Jan 03 '19 00:01 aarongustafson

There Liquid docs actually have quite a few numerical examples, but they all return as strings 😣

This might be a good update for the documentation.

aarongustafson avatar Jan 03 '19 07:01 aarongustafson

I kept having Ruby/Jekyll issues when upgrading my Mac, so I have moved off of Jekyll and will not be working on this project anymore, going forward. I am going to flag this as won’t fix, but leave it open in case someone else wants to pick up the project from here.

aarongustafson avatar Jul 22 '21 21:07 aarongustafson