diff --git a/README.md b/README.md index f3f7a52..a5f1458 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ This is my category info etc. **Important:** Every time new content added (post, pages, category), or you make changes that change the folder structure or filenames, simply delete the `index` and `widget` folder inside `cache` folder so that the changes detected by HTMLy. -**Post Views Limitations:** HTMLy using the filename path as the ID for the post/page views counter. So if you edit a post/page without using the dashboard which results in changes to the folder structure or filename, then you must edit `views.json` in the `content/data/` folder manually to update to correct path. +**Post Views limitations:** HTMLy using the filename path as the ID for the post/page views counter. So if you edit a post/page without using the dashboard which results in changes to the folder structure or filename, then you must edit `views.json` in the `content/data/` folder manually to update to the correct path. Static pages ------------ diff --git a/system/includes/functions.php b/system/includes/functions.php index 8f962de..c511f81 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -692,42 +692,9 @@ function find_page($static = null) foreach ($pages as $index => $v) { if (is_null($static)) { - $post = new stdClass; - // The static page URL - $url= $v['filename']; - - $post->url = site_url() . $url; - - $post->file = $v['dirname'] . '/' . $v['basename']; - $post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file))); - - $post->md = $url; - $post->slug = $url; - $post->parent = null; - - // Get the contents and convert it to HTML - $content = file_get_contents($post->file); - - // Extract the title and body - $post->title = get_content_tag('t', $content, 'Untitled static page: ' . format_date($post->lastMod, 'l, j F Y, H:i')); + return get_pages($pages, 1, null); - // Get the contents and convert it to HTML - $post->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); - - if (config('views.counter') == 'true') { - $post->views = get_views($post->file); - } else { - $post->views = null; - } - - $post->description = get_content_tag("d", $content, get_description($post->body)); - - $word_count = str_word_count(strip_tags($post->body)); - $post->readTime = ceil($word_count / 200); - - $tmp[] = $post; - } elseif (stripos($v['basename'], $static . '.md') !== false) { // Use the get_posts method to return @@ -781,40 +748,7 @@ function find_subpage($static, $sub_static = null) if (is_null($sub_static)) { - $post = new stdClass; - - // The static page URL - $url= $v['filename']; - $post->url = site_url() . $static . "/" . $url; - - $post->file = $v['dirname'] . '/' . $v['basename']; - $post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file))); - - $post->md = $url; - $post->slug = $url; - $post->parent = $static; - - // Get the contents and convert it to HTML - $content = file_get_contents($post->file); - - // Extract the title and body - $post->title = get_content_tag('t', $content, 'Untitled static subpage: ' . format_date($post->lastMod, 'l, j F Y, H:i')); - - // Get the contents and convert it to HTML - $post->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); - - if (config('views.counter') == 'true') { - $post->views = get_views($post->file); - } else { - $post->views = null; - } - - $post->description = get_content_tag("d", $content, get_description($post->body)); - - $word_count = str_word_count(strip_tags($post->body)); - $post->readTime = ceil($word_count / 200); - - $tmp[] = $post; + return get_subpages($sub_pages, 1, null); } elseif (stripos($v['basename'], $sub_static . '.md') !== false) {