Giter Club home page Giter Club logo

kirby-git-content's Introduction

Kirby - Git Content

This is a plugin for Kirby 3 that commits and pushes changes made via the Panel to your git repository.

⚠️ The current version only supports Kirby 3. For Kirby 2 support please use version 2 of this plugin.

Usage

Just keep using the Panel as you are used to and watch the commits appear in your git repository!

Installation

Create a new git repository for your content

Create a new git repository where you push your content to, name it your-project_content.

Init the content repo and push it

Remove the content/ folder from your current git repository

git rm --cached -r content
git add -A
git commit -m "Move Content Folder to separate repository"

Add the content/ folder to new git repository

cd content
git init
git remote add origin https://github.com/your-project/your-project_content.git
git add -A
git commit -m "Initial Content Commit"
git push origin master

Download and configure the Plugin

composer require thathoff/kirby-git-content

To install this plugin without composer (not recommended):

We might create downloadable releases in the future which will make the above steps unnecessary.

Options

By default this plugin just commits changes to the content repository. It’s recommended to setup a cron job which calls yourdomain.com/git-content/push. This will push changes to the remote repository. By using a cron job saving pages in panel is a lot faster then enabling the push option which will push changes after every commit.

This plugin is configurable via Kirby Options. Add the following entires to your config.php.

return [
  // other configuration options
  'thathoff' => [
    'git-content' => [
      'commit' => true,
    ],
  ],
]

Configuration Options

  • path (String): Path to the repository, (default: kirby()->root("content"))
  • branch (String): branch name to be checked out (default: currently checked out branch)
  • pull (Boolean): Pull remote changes first? (default: false)
  • commit (Boolean): Commit your changes? (default: true)
  • push (Boolean): Push your changes to remote? (default: false)
  • commitMessageTemplate (String): Configure the template for the commit message (default: :action:(:item:): :url:)
  • cronHooksEnabled (Boolean): Whether /git-content/push and /git-content/pull endpoints are enabled or not. (default: true)
  • displayErrors (Boolean): Display git errors when saving pages (default: false)
  • gitBin (String): Path to the git binary, See Git.php Git::set_bin(string $path)
  • windowsMode (Boolean): See Git.php Git::windows_mode() (default: false)

Custom Commit Message

By default the commit message is composed from the template :action:(:item:): :url:. So for example a change to the page example will be committed with the message update(page): example. If you would like to change that message you can use the thathoff.git-content.commitMessageTemplate option to overwrite the template.

Configuration Options

Git LFS

Your repository might increase over time, by adding Images, Audio, Video, Binaries, etc. cloning and updating your content repository can take a lot of time. If you are able to use Git LFS you probably should. Here is what the .gitattributes-File could look like:

*.zip filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text

Authors

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.