Add a button to the page-editing view of the admin panel that takes you to the current page on the frontend of the site
  • PHP 76.8%
  • JavaScript 23.2%
Find a file
2025-10-14 22:00:19 +01:00
assets remove language from JS, add title to button 2025-10-11 22:49:49 +01:00
vendor v1 commit 2025-07-09 23:47:11 +01:00
.gitattributes Initial commit 2025-07-09 23:45:29 +01:00
admin-view-current-page.php v0.1.1 - hopeful fix for #1 2025-10-14 21:59:58 +01:00
admin-view-current-page.yaml v1 commit 2025-07-09 23:47:11 +01:00
blueprints.yaml v0.1.1 - hopeful fix for #1 2025-10-14 21:59:58 +01:00
CHANGELOG.md v1 commit 2025-07-09 23:47:11 +01:00
composer.json v1 commit 2025-07-09 23:47:11 +01:00
composer.lock v1 commit 2025-07-09 23:47:11 +01:00
languages.yaml v1 commit 2025-07-09 23:47:11 +01:00
LICENSE v1 commit 2025-07-09 23:47:11 +01:00
README.md Update README.md 2025-10-12 11:17:48 +01:00
screenshot.png v1 commit 2025-07-09 23:47:11 +01:00

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).

Screenshot of the button as inserted into the page-editing toolbar

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.

screenshot showing the location and visual styling of the button

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