Skip to content

Commit

Permalink
Add the category as a property
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Apr 19, 2022
1 parent 62f3793 commit 648bc31
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Models/MarkdownPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class MarkdownPost extends MarkdownDocument
use HasDateString;
use HasFeaturedImage;

public string $category;

public static string $sourceDirectory = '_posts';
public static string $parserClass = MarkdownPostParser::class;

Expand All @@ -22,5 +24,7 @@ public function __construct(array $matter, string $body, string $title = '', str
$this->constructMetadata();
$this->constructDateString();
$this->constructFeaturedImage();

$this->category = $this->matter['category'] ?? '';
}
}

0 comments on commit 648bc31

Please sign in to comment.