diff --git a/www/src/db_handler/post.php b/www/src/db_handler/post.php index a61504f..8c93eee 100644 --- a/www/src/db_handler/post.php +++ b/www/src/db_handler/post.php @@ -49,6 +49,7 @@ class Post implements ArrayAccess { $icon_mapping = [ '' => 'question', 'text/markdown' => 'markdown', + 'markdown' => 'markdown', 'blog' => 'markdown', 'blog_list' => 'rectangle-list', 'directory' => 'folder', @@ -59,6 +60,14 @@ class Post implements ArrayAccess { return $icon_mapping[$type] ?? 'unknown'; } + public static function _deduce_template($type) { + $template_mapping = [ + 'directory' => 'directory' + ]; + + return $template_mapping[$type] ?? 'vanilla'; + } + function __construct($post_handler, $post_data, $site_defaults) { $this->handler = $post_handler; @@ -90,6 +99,7 @@ class Post implements ArrayAccess { $data['type'] ??= self::_deduce_type($post_data['path']); $data['icon'] ??= self::_deduce_icon($data['type']); + $data['template'] ??= self::_deduce_template($data['type']); if(isset($sql_meta['media_url'])) { $data['thumb_url'] ??= $data['media_url'];