Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Help me understand filters

Started by Soulrain 9 years ago · 1 replies · 480 views
9 years ago

Hello good people!

I need some help to better undestand how filters work. So, what I have now is a general category which is applied to all posts and then I use something like

YAML
filters:
  category:
    - Posts

for the search and archives plugin etc.

It works but if a post is saved but not yet published (like a "draft") it will show up on the list when it shouldn't. The same goes for the recent posts list.

In addition to that, I tried using

TXT
    filters:
        - @taxonomy: [tag]

just to test the search but then it comes back with zero results, even when I search for a specific, known tag. Maybe I'm missing something.

I was wondering if it's possible to eliminate the need for a category filter and instead use something that includes only published posts. I know about the published: true header but I don't know how to apply it in a plugin config or in Twig.

9 years ago

The whole thing with the taxonomy and tag and all that stuff is a headache.
I managed to make search work by just letting it empty. If i try to add a category,it wont work. Makes sense (ironic tense)

and by empty I mean I had to MANUALLY edit the YAML file of seach and replace/add this:
ffilters:
category:

  • '@none'

Through the ACP it wont edit the file correctly and wont accept or save that parameter.I had read some topics that some plugins wont save a correct configuration.

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 80 10 hours ago
General · by pamtbaau, 15 hours ago
1 51 15 hours ago
General · by Andy Miller, 1 day ago
0 45 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago