Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have filters to get numbers ? #124

Open
maxandersen opened this issue Dec 26, 2018 · 5 comments
Open

have filters to get numbers ? #124

maxandersen opened this issue Dec 26, 2018 · 5 comments
Labels

Comments

@maxandersen
Copy link
Contributor

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.

@aarongustafson
Copy link
Owner

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.

@maxandersen
Copy link
Contributor Author

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.

@aarongustafson
Copy link
Owner

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

@aarongustafson
Copy link
Owner

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants