下書き記事

This commit is contained in:
2025-12-29 17:00:55 +09:00
parent 863bdabf59
commit 113e0a00fb
4 changed files with 5 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ class BlogPost {
*
* @return array 投稿の配列
*/
public function getPosts(string $section, ?\stdClass $user): array {
public function getPosts(string $section, ?\stdClass $user = null): array {
$path = ROOT.$section;
$posts = [];
$isMember = $user !== NULL && $user->role !== \Roles::BANNED;
@@ -45,6 +45,7 @@ class BlogPost {
$articleBody = trim($parts[1]);
$preview = mb_substr(strip_tags($articleBody), 0, 50).'...';
$slug = basename($file, '.md');
if (isset($metadata['draft']) && !$isStaff) continue;
$posts[] = [
'title' => $metadata['title'] ?? '',