statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

limit on taxonomies not working #1842

Open beckysoll opened 6 years ago

beckysoll commented 6 years ago

Expected behaviour

On an entry, i'd expect to be able to loop through linked taxonomy terms (from an actual taxonomy field, eg. categories) and add a limit like so {{ categories limit="1" }}{{ title }}{{ /categories }}

Actual behaviour

It returns nothing. If i remove the limit and wrap the inside of the categories loop with {{ if first }} that works. I can also do {{ categories:0 }} but then i'm not able to pull in the taxonomy's data, just the actual slug.

Steps to reproduce

  1. try to loop through taxonomy terms for an entry and add some limit to the opening tag.

Server Details

Operating System: Mac OS (working locally)

Web Server: Apache via MAMP Pro

PHP Version: 7.1.12

Statamic Version: 2.8.8

Updated from an older Statamic or fresh install: updated

List of installed addons: anchor, increment, expires on (mine)

beckysoll commented 6 years ago

I should add, offset does not work in exactly the same way limit doesn't work.

jasonvarga commented 6 years ago

The issue is that no modifiers work :)

beckysoll commented 6 years ago

Aaaaah, well that'll do it.

jesseleite commented 6 years ago

Hmm, seems to work for me, but in maybe an unexpected way...

I have three terms on this post:

{{ tags }}{{ title }}<br>{{ /tags }}

coffee
harry-potter
spring

The limit of 1 works for me, but title isn't available, so it gets that from the post's context:

{{ tags limit="1" }}{{ title }}<br>{{ /tags }}

Test Blog Post

If I echo value instead of title, it works as expected:

{{ tags limit="1" }}{{ value }}<br>{{ /tags }}

coffee

@beckysoll It returns nothing at all for you?