diff --git a/public_html/media/js/core.js b/public_html/media/js/core.js index 328a606b..6877a05a 100644 --- a/public_html/media/js/core.js +++ b/public_html/media/js/core.js @@ -346,7 +346,7 @@ function attachTagIt(target) $.each(data.tags, function(i, tag) { var link = $(''); - link.attr('href', '/posts/' + tag.name + '/'); + link.attr('href', tag['search-link']); link.text('#' + tag.name); link.click(function(e) { diff --git a/src/Controllers/TagController.php b/src/Controllers/TagController.php index 153cbe6f..799bd187 100644 --- a/src/Controllers/TagController.php +++ b/src/Controllers/TagController.php @@ -64,8 +64,13 @@ class TagController extends AbstractController array_values(array_map( function($tag) { + $searchLink = Core::getRouter()->linkTo( + ['PostController', 'listView'], + ['query' => $tag->getName(), 'page' => 1]); + return [ 'name' => $tag->getName(), + 'search-link' => $searchLink, 'count' => $tag->getPostCount(), ]; }, $ret->entities));