Console Log is a simple plugin that provides a way to leave a message in the browser's console. I developed this plugin for personal use to make it easy to leave Easter eggs in the console for anyone that looks. You can view the console in your browser's developer tools.
To use this plugin, you need to first enable the plugin and Twig processing for your page. Twig processing can be enabled for a page in the admin panel by going to the Advanced tab for your page and checking Twig under the Process section. Once Twig processing is enabled, simply add the following function anywhere in your page:
{{ conlog("Replace this with your text") }}
The text within the quotation marks will be printed to the browser's console every time the page is loaded.
Console Log requires Grav v1.7.0 or greater. Older versions may work, but the plugin may not function as intended.
There are two ways to install the Console Log plugin, you can install it using the built-in GPM (Grav Package Manager) or manually with the zip file.
Note: GPM Installation/Update will not be available until this plugin is added to the Grav Repository.
This is the best way to install the plugin. From the root of your Grav install simply type:
bin/gpm install consolelog
This plugin will be installed into the /user/plugins/console-log directory. It is entirely self-contained in this folder.
First, download the zip version of this repository and extract it. Make sure the resulting folder is named console-log. Then place this folder within the /user/plugins directory. The plugin is then available for use, and should be visible in the Grav Admin Panel if installed.
TLDR: Download zip, rename to console-log, and place within /user/plugins.
The directions below will help you update the Console Log plugin, simply follow the instructions for your preferred installation method.
Similar to how the plugin is installed, navigate to the root of your Grav install and type:
bin/gpm update console-log
The plugin will now be up to date.
Manually updating has a few more steps but is still simple. Start off by deleting the /user/plugins/console-log directory. Download the latest zip version of this repository and unzip it. Make sure the unzipped folder is named console-log. Place the folder within /user/plugins. The latest version of Console Log should now be installed and functioning.
Thank you to the Grav team for their wonderful examples and recipes, which were referenced heavily during the creation of this plugin.