/** * The homepage for an Airship. * * @route / */ public function index() { $this->blog = $this->blueprint('Blog'); if (!\file_exists(ROOT . '/public/robots.txt')) { // Default robots.txt \file_put_contents(ROOT . '/public/robots.txt', "User-agent: *\nAllow: /"); } $blogRoll = $this->blog->recentFullPosts((int) ($this->config('homepage.blog-posts') ?? 5)); $mathJAX = false; foreach ($blogRoll as $i => $blog) { $blogRoll[$i] = $this->blog->getSnippet($blog); if (Binary::safeStrlen($blogRoll[$i]['snippet']) !== Binary::safeStrlen($blog['body'])) { $blogRoll[$i]['snippet'] = \rtrim($blogRoll[$i]['snippet'], "\n"); } $mathJAX |= \strpos($blog['body'], '$$') !== false; } $args = ['blogposts' => $blogRoll]; $this->config('blog.cachelists') ? $this->stasis('index', $args) : $this->lens('index', $args); }
/** * Blog post home * * @route / */ public function index() { $blogRoll = $this->blog->recentFullPosts((int) $this->config('homepage.blog-posts') ?? 5); $mathJAX = false; foreach ($blogRoll as $i => $blog) { $blogRoll[$i] = $this->blog->getSnippet($blog); if (Binary::safeStrlen($blogRoll[$i]['snippet']) !== Binary::safeStrlen($blog['body'])) { $blogRoll[$i]['snippet'] = \rtrim($blogRoll[$i]['snippet'], "\n"); } $mathJAX = $mathJAX || \strpos($blog['body'], '$$') !== false; } $args = ['pageTitle' => \__('Blog'), 'blogroll' => $blogRoll, 'mathjax' => $mathJAX]; $this->config('blog.cachelists') ? $this->stasis('blog/index', $args) : $this->lens('blog/index', $args); }