New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Bug: Taxonomy & Folder

Ethan Beyer September 23, 2014 by Ethan Beyer

Hello!

I've been having a problem with the Suggest Fieldtype and the folders it searches.

First off, here's the adorable structure of my _content folder:

_content/
   01-animals/
      puppies/
         2014-03-13-1123-daschund.md
         2014-02-29-1621-australian-cattle-dog.md
         fields.yaml
      kittens/
         2014-05-21-1234-callico.md
         2014-04-30-2345-longhair-snubnose.md
         fields.yaml
   02-pastries/
      sweet/
          cinnamon-roll.md
          sticky-bun.md
          rice-krispy-treat.md
      savory/
          bacon-wrap-yum.md
          quiche.md

Now let's say I've got a taxonomy called tags.

Further suppose that the tags taxonomy is in place in the fieldset that populates puppies/ and kittens/.

In the docs, I am not led to believe this would be a problem because there's the folder attribute.

So the code for the tags Suggest FT would look like this:

  tags:
    type: suggest
    display: "Tags"
    max_items: 4
    placeholder: "Make sure you pick your tags!"
    allow_blank: false
    required: true
    taxonomy:
      folder: kittens
      type: tags
      create: true

All the tags in kittens/:

  • awesome
  • cute
  • funny
  • fail

Now, the puppies/ entries each have only one tags value:

  • adorable

The problem is that when I go into create a new kitten entry, and I click into the Suggest box, I see:

  • adorable
  • awesome
  • cute
  • funny
  • fail

See the problem? It's pulling ALL tags values from both 01-animals/ folders. So I thought, ok, I'll just be more specific: folder: animals/kittens for kittens/, and folder: animals/puppies for puppies/.

No change whatsoever.

Then I tried to make a new puppy and saw all five tags there, too. So puppy tags are showing up in kittens, and vice versa.

Then I did a further test. I added tags: "yummy" to the front matter of cinnamon-roll.md.

When I go to create a kitten or puppy now....

  • adorable
  • awesome
  • cute
  • funny
  • fail
  • yummy

O NOEZ. My clients will think I am encouraging the eating of adorable creatures. So the real problem seems to be the folder: ... is ignored, and it searches the entire _content folder for any .md file that has tags: ... in the Front Matter.

Lastly, it would seem that the {{ taxonomy:listing folder="kittens" type="tags" }} has the same behavior, as the output on the kittens page includes yummy.

When I started this post, I really thought the issue was with the Suggest FT, but it seems like it's with Taxonomies and Folders.

Is anybody else having an issue like this?

Answered by Jason Varga!
>>>>>>> Answered <<<<<<<
4 Replies
2 Followers