Giter Site home page Giter Site logo

bitstarr / grav-plugin-admin-addon-media-metadata Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clivebeckett/grav-plugin-admin-addon-media-metadata

0.0 1.0 0.0 135 KB

This plugin is an addon for the Grav CMS Admin plugin and lets you add and edit metadata for media files

License: MIT License

JavaScript 21.47% PHP 69.20% CSS 3.05% Twig 6.28%

grav-plugin-admin-addon-media-metadata's Introduction

Admin Addon Media Metadata Plugin

The Admin Addon Media Metadata Plugin is an extension for the Grav CMS Admin plugin. It lets you add and edit metadata for media files in the Page Media browser.

The Admin plugin has not been offering a feature like this yet. In order to add/edit metadata e.g. for an image you had to create a [image.filename].meta.yaml for the image in your file browser and edit it in a text editor.

Usage and Features

  • the plugin will create and edit [mediafile].meta.yaml files in your page folder via a simple form in the Admin plugin
  • by default you can add/edit a title, alt text, and a caption – see Configuration section below on how to adapt this for your Grav installation
  • multiline text can be added (e.g. for caption)
  • in case you are storing additional, manually added data in your [mediafile].meta.yaml file, it will not be overwritten even if the form does not let you change it

How to use it

(see also screenshots below)

  1. hover any file in your Page Media section
  2. hit the small «i» button to open the metadata form (the regular «i» button which just showed the metadata will be overwritten by the plugin)

NOTE on setting “Auto metadata from Exif”

If your system is set to automatically write EXIF metadata
(system.yaml → media.auto_metadata_exif: true)

  • On Admin Plugin 1.10:
    Please save the page after uploading an image and before you write additional metadata using this plugin. On saving the page, the Admin Plugin will create the meta.yaml file including the EXIF data – but it won’t do so if a meta.yaml file already exists.
  • On Admin Plugin 1.9 and admin-addon-media-metadata >= 1.1.0:
    There’s no problem here: the EXIF data will be written immediately upon upload whereas this plugin now only writes or edits meta.yaml files when needed.

Installation

Grav Package Manager (GPM)

If you can access your Grav installation via the command line, install the plugin by typing the following from your Grav root:

bin/gpm install admin-addon-media-metadata

Admin Tool Web Interface

In the Plugins section, hit the [+ Add] button, search for Admin Addon Media Metadata and install.

Manual Installation

To install the plugin manually, download the ZIP version of the latest release of this repository and unzip it under /your/site/grav/user/plugins. Then rename the folder to admin-addon-media-metadata. You can find these files on GitHub.

Configuration

The default fields in the metadata form are alt, title, and caption. If you want to add more data to your meta.yaml files, please copy
user/plugins/admin-addon-media-metadata/admin-addon-media-metadata.yaml to
user/config/plugins/admin-addon-media-metadata.yaml
and add more form fields to the form by updating the copy. E.g. if you want to add a field for a web link, you might add the following lines:

  - type: text
    label: Web link
    name: weblink
    placeholder: https://domain.tld/

The URL field will be available in your metadata form and you’ll be able edit the information.

Do not remove or edit filename or filepath fields as the plugin requires them to run properly.

Additional Page Specific Metadata Fields (v1.1 and later)

You may also add page specific fields to a page’s frontmatter. Note: The fields will be added to the form, not override the ones from the above mentioned config files:

admin-addon-media-metadata:
  metadata_form:
    fields:
      -
        type: text
        label: 'Yet another field'
        name: yetAnotherField
        placeholder: 'yet yet yet'

Credits

I have based the plugin on Dávid Szabó’s Admin Addon Media Rename plugin. Much of the code would not have been possible for me without Dávid’s work.

@renards helped a lot in replacing my original self-written Yaml parsing and writing code with Grav core technology and thus made version 1.0.0 possible.

Screenshots

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.