diff --git a/system/htmly.php b/system/htmly.php index 2e8ac5cf..e917f7a6 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -3045,6 +3045,58 @@ ), $layout); }); +// Show categories with descriptions on /category page +get('/category', function () { + + if (!login()) { + file_cache($_SERVER['REQUEST_URI']); + } + + $categories = get_category_info(); + + $categoriesData = array( + 'title' => generate_title('is_default', i18n('Categories')), + 'description' => i18n('Categories').' '.i18n('of').' '.safe_html(strip_tags(blog_tagline())), + 'metatags' => generate_meta(null, null), + 'canonical' => site_url() . 'category', + 'is_categories' => true + ); + + $vroot = rtrim(config('views.root'), '/'); + + $lt = $vroot . '/layout--categories.html.php'; + if (file_exists($lt)) { + $layout = 'layout--categories'; + } else { + $layout = ''; + } + + $pv = $vroot . '/main--categories.html.php'; + if (file_exists($pv)) { + $pview = 'main--categories'; + $categoriesData['categories'] = $categories; + } else { + $pview = 'main'; + $categoriesData['posts'] = $categories; + //fallback for custom themes lacking main--categories.html.php + foreach ($categories as $category) { + $category->category = i18n('Categories'); + $category->tag = NULL; + $category->readTime = "0"; + $category->authorName = "Admin"; + if (!empty(config('default.image'))) { + $category->authorAvatar = config('default.image'); + } else $category->authorAvatar = NULL; + $category->authorUrl = '#'; + if (file_exists($category->file)) { + $category->date = filemtime($category->file) ; + } else $category->date = NULL; + } + } + + render($pview, $categoriesData); +}); + // Show the RSS feed get('/category/:category/feed', function ($category) { diff --git a/themes/blog/main--categories.html.php b/themes/blog/main--categories.html.php new file mode 100644 index 00000000..9286d50d --- /dev/null +++ b/themes/blog/main--categories.html.php @@ -0,0 +1,18 @@ + +
+
+

+
+
+ +
+ count > 0): ?> +

title; ?>

+ +

title; ?>

+ +

description; ?>

+
+ +
+
\ No newline at end of file diff --git a/themes/clean/main--categories.html.php b/themes/clean/main--categories.html.php new file mode 100644 index 00000000..9286d50d --- /dev/null +++ b/themes/clean/main--categories.html.php @@ -0,0 +1,18 @@ + +
+
+

+
+
+ +
+ count > 0): ?> +

title; ?>

+ +

title; ?>

+ +

description; ?>

+
+ +
+
\ No newline at end of file diff --git a/themes/doks/main--categories.html.php b/themes/doks/main--categories.html.php new file mode 100644 index 00000000..9286d50d --- /dev/null +++ b/themes/doks/main--categories.html.php @@ -0,0 +1,18 @@ + +
+
+

+
+
+ +
+ count > 0): ?> +

title; ?>

+ +

title; ?>

+ +

description; ?>

+
+ +
+
\ No newline at end of file diff --git a/themes/logs/main--categories.html.php b/themes/logs/main--categories.html.php new file mode 100644 index 00000000..9286d50d --- /dev/null +++ b/themes/logs/main--categories.html.php @@ -0,0 +1,18 @@ + +
+
+

+
+
+ +
+ count > 0): ?> +

title; ?>

+ +

title; ?>

+ +

description; ?>

+
+ +
+
\ No newline at end of file diff --git a/themes/readable/main--categories.html.php b/themes/readable/main--categories.html.php new file mode 100644 index 00000000..9286d50d --- /dev/null +++ b/themes/readable/main--categories.html.php @@ -0,0 +1,18 @@ + +
+
+

+
+
+ +
+ count > 0): ?> +

title; ?>

+ +

title; ?>

+ +

description; ?>

+
+ +
+
\ No newline at end of file diff --git a/themes/twentyfifteen/main--categories.html.php b/themes/twentyfifteen/main--categories.html.php new file mode 100644 index 00000000..9286d50d --- /dev/null +++ b/themes/twentyfifteen/main--categories.html.php @@ -0,0 +1,18 @@ + +
+
+

+
+
+ +
+ count > 0): ?> +

title; ?>

+ +

title; ?>

+ +

description; ?>

+
+ +
+
\ No newline at end of file diff --git a/themes/twentysixteen/main--categories.html.php b/themes/twentysixteen/main--categories.html.php new file mode 100644 index 00000000..9286d50d --- /dev/null +++ b/themes/twentysixteen/main--categories.html.php @@ -0,0 +1,18 @@ + +
+
+

+
+
+ +
+ count > 0): ?> +

title; ?>

+ +

title; ?>

+ +

description; ?>

+
+ +
+
\ No newline at end of file