'', 'production' => false, 'siteName' => 'Blog Starter Template', 'siteDescription' => 'Generate an elegant blog with Jigsaw', 'siteAuthor' => 'Author Name', // collections 'collections' => [ 'posts' => [ 'author' => 'Author Name', // Default author, if not provided in a post 'sort' => '-date', 'path' => 'blog/{filename}', ], 'categories' => [ 'path' => '/blog/categories/{filename}', 'posts' => function ($page, $allPosts) { return $allPosts->filter(function ($post) use ($page) { return $post->categories ? in_array($page->getFilename(), $post->categories, true) : false; }); }, ], ], // helpers 'getDate' => function ($page) { return Datetime::createFromFormat('U', $page->date); }, 'getExcerpt' => function ($page, $length = 255) { if ($page->excerpt) { return $page->excerpt; } $content = preg_split('//m', $page->getContent(), 2); $cleaned = trim( strip_tags( preg_replace(['/
[\w\W]*?<\/pre>/', '/[\w\W]*?<\/h\d>/'], '', $content[0]),
                ''
            )
        );

        if (count($content) > 1) {
            return $content[0];
        }

        $truncated = substr($cleaned, 0, $length);

        if (substr_count($truncated, '') > substr_count($truncated, '')) {
            $truncated .= '';
        }

        return strlen($cleaned) > $length
            ? preg_replace('/\s+?(\S+)?$/', '', $truncated) . '...'
            : $cleaned;
    },
    'isActive' => function ($page, $path) {
        return Str::endsWith(trimPath($page->getPath()), trimPath($path));
    },
];