# YouTube Consent Plugin The **YouTube Consent** Plugin is an extension for [Grav CMS](https://github.com/getgrav/grav). It registers the new `youtube` shortcodes to link videos in a privacy-friendly manner. ## Installation Installing the YouTube Consent 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) To install the plugin via the [GPM](https://learn.getgrav.org/cli-console/grav-cli-gpm), through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter: bin/gpm install youtubeconsent This will install the plugin into your `/user/plugins`-directory within Grav. Its files can be found under `/your/site/grav/user/plugins/youtubeconsent`. ### 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 `youtubeconsent`. You can find these files on [here](https://gitea.dithosoft.de/thorsten/grav-youtubeconsent-plugin.git) or via [GetGrav.org](https://getgrav.org/downloads/plugins). You should now have all the plugin files under /your/site/grav/user/plugins/youtubeconsent ### 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/youtubeconsent/youtubeconsent.yaml` to `user/config/plugins/youtubeconsent.yaml` and only edit that copy. Here is the default configuration and an explanation of available options: ```yaml # Enables or disables the plugin enabled: true # Specifies the default width for the video container default_width: 720 # Specifies the default height for the video container default_height: 405 # Specifies the YouTube quality parameter default_quality: 'hd1080' # Specifies the background color for the consent notice notice_background: '#FFFFFF' # Specifies the foreground color for the consent notice notice_foreground: '#333333' # Specifies additional CSS class names for the accept buttons accept_link_class: button # Specifies the notice text (if empty, a default text is used) notice_text: # Specifies the caption of the "Accept" button (if empty, a default text is used) accept_text: # Specifies the caption of the "Accept for all" button (if empty, a default text is used) accept_all_text: ``` Note that if you use the Admin Plugin, a file with your configuration named `youtubeconsent.yaml` will be saved in the `user/config/plugins/`-folder once the configuration is saved in the Admin. ## Required plugins The YouTube consent plugin requires the following plugins to be installed and activated: | Plugin | URL | | -------------- | ----------------------------------------------------- | | Shortcode Core | https://github.com/getgrav/grav-plugin-shortcode-core | ## Usage Once enabled and configured, you can use the `[youtube]` shortcode to include videos from YouTube in a privacy friendly manner. The shortcode is used as follows: [youtube start=... width=... height=... quality=...][/youtube] The following optional parameters are available: | Parameter | Default value | Description | | --------- | ------------- | ----------- | | start | 0 | The number of seconds into the video to start from | | width | Configuration value | The width of the player frame in pixels | | height | Configuration value | The height of the player frame in pixels | | quality | Configuration value | The specifier for the default video quality | ## Cookies The "Accept all" button will set the `grav_youtubeconsent` cookie for the site with the value of `true` and a lifetime of 365 days to remember the user's decision. This can be considered a functional cookie that does not require visitor's consent.