Git Product home page Git Product logo

kirby-sanitize-filenames's Introduction

Kirby Sanitize Filenames

Sanitize Filenames for Kirby CMS โ€“ This plugin automatically transforms and sanitizes filenames using file hooks. It can converts filenames to snake_case or kebab-case. It also sanitizes filenames by modifying special characters and allows adding a custom prefix for consistent file naming.

Installation

Download

Download and copy this repository to /site/plugins/kirby-sanitize-filenames.

Composer

composer require timnarr/kirby-sanitize-filenames

Usage

The plugin listens for these two Kirby hooks, and when these are triggered, the filename gets manipulated:

  • file.create:after
  • file.replace:after

This plugin does not support the changeName hook because file renaming, which occurs after the create and replace hooks, will trigger the changeName hook too. This could lead to some misbehaviors. However, it is beneficial to be able to change the filename after the initial upload and filename manipulation.

Config

You can choose between snake and kebab style. The prefix will also be transformed to a safe-name and a delimiter gets appended: _ for snake and - for kebab style.

'timnarr.sanitize-filenames' => [
  'caseStyle' => 'snake',
  'prefix' => 'timnarr'
]

License

MIT License Copyright ยฉ 2023 Tim Narr

kirby-sanitize-filenames's People

Contributors

timnarr avatar

Stargazers

 avatar

Watchers

 avatar

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.