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

Setting max items to "1" for a taxonomy renders blank content when not using {{relate}} tag #1391

Closed
boomshiddang opened this Issue Apr 17, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@boomshiddang

boomshiddang commented Apr 17, 2017

Expected behaviour

You should be able to use {{tags}} instead of having to revert to the deprecated {{relate:tags}} to render a taxonomy field with a 1 term limit.

Actual behaviour

If a taxonomy field has a max items limit set to 1, you have to use the deprecated {{relate:tags}} tag in order to render your content. Otherwise nothing is shown.

Additionally, when there is a limit of 1, the YAML output is like so:
tags: term
vs.
tags: -term

Steps to reproduce

  1. Set up a taxonomy field, let's call it 'tags'
  2. Set Max Items to 1
  3. In template code, use the following code:
    {{tags}} <span class="category">{{title}}</span> {{/tags}}
  4. You'll see nothing but the title of the term be rendered.
  5. Change code to:
    {{relate:tags}} <span class="category">{{title}}</span> {{/relate:tags}}
  6. And everything works again

Server Details

Operating System:
Mac OS 10.12.3

Web Server:
MAMP

PHP Version:
5.5.26

Statamic Version:
2.5.8

Updated from an older Statamic or fresh install:
updated from 2.11

List of installed addons:
none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment