So how do I mix the @root.descendants' with the { '@taxonomy.type':'event', }, like syntax ?
Do we also agree that each content type registed as a blueprint of a page has a taxonomy.type equal to blueprints name (or title of blueprint) ? As I tried to use the same syntax as for event above but I didn"t get any result
Hmm, I don’t see the point of defining the ‘recentnews’ collection. The ‘events’ will already grab all the page that has for taxonomy 'events’
You can do your filter with just
{% set blogpost =
page.collection({
'items':{
'@taxonomy.type':'blogpost',
},
'dateRange': {
'start': datetools.today,
'end': datetools.parseDate('next three months')
},
'order': {
'by': 'date',
'dir': 'desc'
},
'limit': 10
})
%}
```
Note that you can use anything for the date range, so 'next three months' should work, and is more 'future-proof.
Hope it helps,
Ok sorry, I should have been more explicit. On the home page, I have 3 blocks in which I want to display :
next events ; this is done with the code above and it works, filtering on events type.
recents news : where I could display latest pagecvsq (name of the blueprint I created)
latest classified ads : where I could display latest classified ads wherever they come from on the site base on the content type “classifiedads” (name of the blueprint)
When I do this, I have no output and from debug previously, I didn’t see the taxonomy.type attribute attached to this content type. At the best, I see the template attribute but don’t know if we can filter on it.
I saw on the doc or on the forum that I could filter on a tag but I don’t expect user to set them manually as they will forget. I’m ok with this if I can define somewhere that all content for this content type has by default a given tag.
// Add these to taxonomy for events management
$event_taxonomies = array('type', 'event_freq', 'event_repeat', 'event_location');
$taxonomy_config = array_merge((array)$this->config->get('site.taxonomies'), $event_taxonomies);
$this->config->set('site.taxonomies', $taxonomy_config);
I ended up with adding to my blueprint file:
header.taxonomy.type:
type: text
label: type - do not change the value
default: blogpost
And thus, I can filter as I except. I would have preferred to have this as an hidden value but can’t find the way so far and I don’t expect to make a plugin for my content type to get same behaviour as events plugin.