- PHP 76.8%
- JavaScript 23.2%
| assets | ||
| vendor | ||
| .gitattributes | ||
| admin-view-current-page.php | ||
| admin-view-current-page.yaml | ||
| blueprints.yaml | ||
| CHANGELOG.md | ||
| composer.json | ||
| composer.lock | ||
| languages.yaml | ||
| LICENSE | ||
| README.md | ||
| screenshot.png | ||
Admin: View Current Page Plugin
The Admin: View Current Page Plugin is an extension for Grav CMS.
When I was setting up sites - or making small tweaks - for clients, I found I was flipping between admin panel and frontend page view a fair bit, refreshing the page each time.
This basic plugin adds a button to the page-editing view of the Admin Plugin that links to the current page on the frontend of the site (or the parent page if the page you're currently editing is a module).
Installation
Installing the Admin: View Current Page plugin can be done in one of three ways: The GPM (Grav Package Manager) installation method lets you quickly install the plugin with a simple terminal command, the manual method lets you do so via a zip file, and the admin method lets you do so via the Admin Plugin.
GPM Installation (Preferred, soon, hopefully)
To install the plugin via the GPM, through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:
bin/gpm install admin-view-current-page
This will install the Admin: View Current Page plugin into your /user/plugins-directory within Grav. Its files can be found under /your/site/grav/user/plugins/admin-view-current-page.
Manual Installation
To install the plugin manually, download the zip-version of this repository and unzip it under /your/site/grav/user/plugins. Then rename the folder to admin-view-current-page. You can find these files on GitHub or via GetGrav.org.
You should now have all the plugin files under
/your/site/grav/user/plugins/admin-view-current-page
NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its blueprints.yaml-file on GitHub.
Admin Plugin
If you use the Admin Plugin, you can install the plugin directly by browsing the Plugins-menu and clicking on the Add button.
Configuration
Before configuring this plugin, you should copy the user/plugins/admin-view-current-page/admin-view-current-page.yaml to user/config/plugins/admin-view-current-page.yaml and only edit that copy.
Here is the default configuration and an explanation of available options:
enabled: true
Note that if you use the Admin Plugin, a file with your configuration named admin-view-current-page.yaml will be saved in the user/config/plugins/ folder once the configuration is saved in the Admin.
Usage
When editing a page in the Admin Plugin, a button should be added, to the left of the Delete button. It should have a link icon on it.
Clicking this button will open a new tab with the URL of the current page as it would appear in the frontend.
If the page you're editing is a module, URL of the page's parent will be used instead.
Credits
This plugin uses an awful lot of Sebastian Laube's Draft Preview plugin as a base (and is pretty much the only reason this plugin exists).
To Do
- Submit to GPM after more testing
- Double-check multi-language support is OK
- Add option to automatically clear page cache when button is clicked
- Make it so the button will only show up if the pertinent page is routable & published (can be reached via the frontend)
- Add ability for meta key + click -> copy URL
