From 715313d953a398585d6056c8ee61dae0734bbcd7 Mon Sep 17 00:00:00 2001 From: Barry <5648875+BarryMode@users.noreply.github.com> Date: Fri, 1 Sep 2017 14:08:39 -0500 Subject: [PATCH] v0.8.4: reverted to previous route method --- CHANGELOG.md | 20 +++++++++++++------- blackhole.php | 11 ++++++++--- blueprints.yaml | 2 +- cli/GenerateCommand.php | 3 +-- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52aae9e..4dcd1d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,16 @@ +#v0.8.4 +## 9/1/2017 + +1. [](#bugfix) + * Reverted to previous route method because collections are inadequate + # v0.8.3 ## 8/18/2017 1. [](#improved) - * Remove modular pages from routes [#18](https://github.com/barrymode/grav-plugin-blackhole/pull/18) + * Remove modular pages from routes ([#18](https://github.com/barrymode/grav-plugin-blackhole/pull/18)) 2. [](#bugfix) - * Fixed output-url [#19](https://github.com/barrymode/grav-plugin-blackhole/pull/19) + * Fixed output-url ([#19](https://github.com/barrymode/grav-plugin-blackhole/pull/19)) # v0.8.2 ## 8/1/2017 @@ -18,7 +24,7 @@ 1. [](#new) * Added timer 2. [](#bugfix) - * Fixed memory growth problem [#16](https://github.com/barrymode/grav-plugin-blackhole/issues/16) + * Fixed memory growth problem ([#16](https://github.com/barrymode/grav-plugin-blackhole/issues/16)) # v0.8.0 ## 7/30/2017 @@ -38,25 +44,25 @@ 1. [](#improved) * Minor optimizations of the file generation method 2. [](#bugfix) - * Fixed mkdir errors [#12](https://github.com/barrymode/grav-plugin-blackhole/issues/12) + * Fixed mkdir errors ([#12](https://github.com/barrymode/grav-plugin-blackhole/issues/12)) # v0.7.0 ## 6/18/2017 1. [](#new) - * Feature: only render pages that have changed/been modified. [#12](https://github.com/barrymode/grav-plugin-blackhole/issues/12) + * Feature: only render pages that have changed/been modified. ([#12](https://github.com/barrymode/grav-plugin-blackhole/issues/12)) # v0.6.0 ## 6/18/2017 1. [](#new) - * Portal function solves [#10](https://github.com/barrymode/grav-plugin-blackhole/issues/10) + * Portal function solves ([#10](https://github.com/barrymode/grav-plugin-blackhole/issues/10)) # v0.5.1 ## 6/1/2017 1. [](#bugfix) - * Fixed [#7](https://github.com/barrymode/grav-plugin-blackhole/issues/7) and [#9](https://github.com/barrymode/grav-plugin-blackhole/issues/9) + * Fixed ([#7](https://github.com/barrymode/grav-plugin-blackhole/issues/7) and [#9](https://github.com/barrymode/grav-plugin-blackhole/issues/9)) # v0.5.0 ## 4/9/2017 diff --git a/blackhole.php b/blackhole.php index a1a4686..48efb4a 100644 --- a/blackhole.php +++ b/blackhole.php @@ -23,9 +23,14 @@ public function onPageInitialized() { $output_path = $this->config->get('plugins.blackhole.output_path'); // get all routes from grav - $routes = $this->grav['pages']->all()->nonModular()->toArray(); - // empty the home page slug - $routes[$this->grav['pages']->all()->current()->path()]['slug'] = ''; + $routes = $this->grav['pages']->routes(); + + // unset modular pages + foreach ($routes as $path => $dir) { + if (strpos($path, '/_') !== false) { + unset($routes[$path]); + } + } if (!empty($_GET['output_path'])) { $this->content = $output_path; diff --git a/blueprints.yaml b/blueprints.yaml index 3dba3ad..51a5963 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Blackhole -version: 0.8.3 +version: 0.8.4 description: Generates an html copy of your website icon: circle author: diff --git a/cli/GenerateCommand.php b/cli/GenerateCommand.php index 343b37c..998d038 100644 --- a/cli/GenerateCommand.php +++ b/cli/GenerateCommand.php @@ -88,8 +88,7 @@ function generate($bh_route, $bh_file_path, $grav_page_data) { // make pages in output path if (count($pages)) { $rollingCurl = new \RollingCurl\RollingCurl(); - foreach ($pages as $grav_file_path => $grav_route) { - $grav_slug = '/' . $grav_route->slug; + foreach ($pages as $grav_slug => $grav_file_path) { $request = new \RollingCurl\Request($input_url . $grav_slug); $request->grav_file_path = $grav_file_path; $request->bh_route = preg_replace('/\/\/+/', '/', $event_horizon . $grav_slug);