Filter::add('pager:url', function ($url) { return Filter::apply('archive:url', $url); }); Config::set(array('page_title' => sprintf($config->archive->title, $year . ', ' . $months[(int) $month - 1]) . $config->title_separator . $config->title, 'archive_query' => $slug, 'offset' => $offset, 'articles' => $articles, 'pagination' => Navigator::extract($s, $offset, $config->archive->per_page, $config->archive->slug . '/' . $slug))); Shield::attach('index-archive'); }, 41); /** * Tag Page * -------- * * [1]. tag/tag-slug * [2]. tag/tag-slug/1 * */ Route::accept(array($config->tag->slug . '/(:any)', $config->tag->slug . '/(:any)/(:num)'), function ($slug = "", $offset = 1) use($config, $excludes) { if (!($tag = Get::articleTag('slug:' . $slug))) { Shield::abort('404-tag'); } $offset = (int) $offset; $s = Get::articles('DESC', 'kind:' . $tag->id); if ($articles = Mecha::eat($s)->chunk($offset, $config->tag->per_page)->vomit()) { $articles = Mecha::walk($articles, function ($path) use($excludes) { return Get::article($path, $excludes); }); } else { Shield::abort('404-tag'); } Filter::add('pager:url', function ($url) { return Filter::apply('tag:url', $url); }); Config::set(array('page_title' => sprintf($config->tag->title, $tag->name) . $config->title_separator . $config->title, 'tag_query' => $slug, 'offset' => $offset, 'articles' => $articles, 'pagination' => Navigator::extract($s, $offset, $config->tag->per_page, $config->tag->slug . '/' . $slug)));
echo '<link>' . $config->url . '/</link>'; echo '<description>' . $config->description . '</description>'; echo '<lastBuildDate>' . Date::format(time(), 'r') . '</lastBuildDate>'; echo '<atom:link rel="self" href="' . $config->url_current . '"/>'; echo $config->offset > 1 ? '<atom:link rel="previous" href="' . Filter::colon('feed:url', $url_base . '/' . ($config->offset - 1)) . '"/>' : ""; echo $config->offset < ceil($config->total_articles / $rss_limit) ? '<atom:link rel="next" href="' . Filter::colon('feed:url', $url_base . '/' . ($config->offset + 1)) . '"/>' : ""; Weapon::fire('rss_meta'); if (!empty($bucket)) { foreach ($bucket as $i => $item) { $title = strip_tags($item->title); $description = $item->description; $kind = Mecha::A($item->kind); echo '<item>'; echo '<title><![CDATA[' . $title . ']]></title>'; echo '<link>' . $item->url . '</link>'; echo '<description><![CDATA[' . $description . ']]></description>'; echo '<pubDate>' . Date::format($item->time, 'r') . '</pubDate>'; echo '<guid>' . $item->url . '</guid>'; if (!empty($kind)) { foreach ($kind as $k) { $tag = Get::articleTag($k); echo '<category domain="' . Filter::colon('tag:url', $config->url . '/' . $config->tag->slug . '/' . $tag->slug) . '">' . $tag->name . '</category>'; } } echo '<source url="' . $item->url . '"><![CDATA[' . $config->title . ': ' . $title . ']]></source>'; Weapon::fire('rss_item', array($item, $i)); echo '</item>'; } } echo '</channel>'; echo '</rss>';