diff --git a/CHANGELOG.md b/CHANGELOG.md index 62b6d6b..f418f7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ +# v0.12.0 +## 3/29/2018 + +1. [](#new) + * Generate button added to Grav admin ([#5](https://github.com/barrymode/grav-plugin-blackhole/issues/5)) +1. [](#improved) + * Assets no longer logs errors when processing data URIs + * Assets ignores canonical links + # v0.11.2 ## 3/28/2018 + 1. [](#improved) * Breaking change: `--copy-assets` -> `--assets` * Assets has been simplified and no longer accepts input. diff --git a/README.md b/README.md index a1c3f0a..b940994 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The **Blackhole** Plugin is for [Grav CMS](http://github.com/getgrav/grav). Why Blackhole? Grav is a space term, so I think this plugin should follow suit. Time stops at the event horizon of a black hole, which is exactly what this plugin does to your website. It freezes it in a state. By Increasing **grav**ity to infinity you get a **static** black hole, or in this case you generate a **static** html copy of your **Grav** website. -*Currently, Blackhole only supports pages.* +*Currently, Blackhole doesn't support taxonomy.* ## Installation @@ -25,7 +25,7 @@ If you can't use GPM you can manually install this plugin. Download the zip vers ### Generate Command -Generate your static site. `generate` can also be written as `gen` or `g`. +The generate command can be used from the command line or directly in the Grav Admin Panel. Generate your static site. `generate` can also be written as `gen` or `g`. - **Input URL** (required) - Set the URL of your live Grav site. diff --git a/blackhole.php b/blackhole.php index 884868e..265eb82 100644 --- a/blackhole.php +++ b/blackhole.php @@ -19,9 +19,6 @@ public function onPageInitialized() { if (!empty($_GET['pages']) && $_GET['pages'] == 'all') { ob_start(); - // get output_path from plugin settings - $output_path = $this->config->get('plugins.blackhole.output_path'); - // get all routes from grav $routes = $this->grav['pages']->routes(); @@ -31,9 +28,12 @@ public function onPageInitialized() { unset($routes[$path]); } } - - // set the content for ?pages=all $this->content = json_encode($routes, JSON_UNESCAPED_SLASHES); + } else if (!empty($_GET['generate']) && $_GET['generate'] == 'true') { + // get generate_command from plugin settings + $generate_command = $this->config->get('plugins.blackhole.generate_command'); + + $this->content = $generate_command; } } @@ -43,5 +43,9 @@ public function onOutputRendered() { ob_end_clean(); echo $this->content; } + // action for generate button + if (!empty($_GET['generate']) && $_GET['generate'] == 'true') { + shell_exec('bin/plugin blackhole generate ' . $this->content); + } } } diff --git a/blueprints.yaml b/blueprints.yaml index e6cad79..ad76d0c 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Blackhole -version: 0.11.2 +version: 0.12.0 description: Static site generator for Grav icon: circle author: @@ -22,4 +22,9 @@ form: 1: Enabled 0: Disabled validate: - type: bool \ No newline at end of file + type: bool + + generate_command: + type: text + label: ' Generate' + default: \ No newline at end of file