Of course, you have to make sure to use the same method for filtering.
That can be done with a route that does the filtering (but then instead of using the param helper, your filter button/select would call the URL and the route return the data for the page.
Hm, and therefore you don’t want to use routes anymore? But if you want to do your filtering with a URL instead of a parameter, I don’t see what would be the alternative? Always willing to help if you get stuck.
(Notice that we use a fourth argument $args that, if it exists, gets additional data from the route)
This is the route:
c::set('routes', array(
array(
'pattern' => 'tag/(:any)',
'action' => function ($tag) {
$p = page('blog');
$children = $p->children()->visible();
// filter articles by tag using the filter with callback method
$results = $children->filter(function($child) use($tag){
// convert each tag item using the str::slug method
$tags = array_map(function($tag) {
return str::slug($tag);
}, $child->tags()->split());
// check if the given tag is in the modified tags array
return in_array($tag, $tags);
});
$data = [
'results' => $results
];
return array('blog', $data);
}
)
));
According to your post above, you want to remove the blog part from the URL when calling your tags. If that was a mistake, you have to add it to the route. I actually think, the route should still contain the blog part, otherwise it’s rather confusing for the user.
Make sure that you use the new tag URL in your tag links. You can use a page model for this.