Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

wangkezun/ghost-github-storage

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pages-store

NPM Downloads NPM Version License Code Style

GitHub Pages Storage Adapter for Ghost

Installation

Via Yarn or NPM

  • Install pages-store module

    yarn add ghost-github-storage
    # or npm
    npm install ghost-github-storage
  • Make the storage folder if it doesn't exist yet

    mkdir -p content/adapters/storage
  • Copy the module into the right location

    cp -vR node_modules/ghost-github-storage content/adapters/storage/ghost-github-storage

Via Git

In order to replace the storage module, the basic requirements are:

  • Create a new folder inside content/adapters called storage

  • Clone this repo to storage

    cd [path/to/ghost]/content/adapters/storage
    git clone https://github.com/wangkezun/ghost-github-storage.git
  • Install dependencies

    cd ghost-github-storage
    yarn
    # or
    npm install

Usage

In your config.[env].json file, you'll need to add a new storage block to whichever environment you want to change:

{
  "storage": {
    "active": "ghost-github-storage",
    "ghost-github-storage": {
      "token": "YOUR_GITHUB_TOKEN",
      "repo": "REPO_NAME",
      "owner": "YOUR_GITHUB_USER_NAME"
    }
  }
}

Adapter will check the repo existence and create a new repo if not exist and check branch existence and checkout a new branch if not exist

Use gh-pages as branch name and leave prefix blank is recommended for github will automatic publish image to github.io

change configs will not affect images that already uploaded.

Options

{
  "storage": {
    "active": "ghost-github-storage",
    "ghost-github-storage": {
      "branch": "gh-pages", // using default is recommended
      "prefix": "https://wangkezun.github.io/ghost-assets", // by default adapter will generate this prefix
      "format": "{yyyy}/{mm}/{dd}/{name}-{uuid}-{timestamp}-{random}{ext}"
    }
  }
}

Contributing

  1. Fork it on GitHub!
  2. Clone the fork to your own machine.
  3. Checkout your feature branch: git checkout -b my-awesome-feature
  4. Commit your changes to your own branch: git commit -am 'Add some feature'
  5. Push your work back up to your fork: git push -u origin my-awesome-feature
  6. Submit a Pull Request so that we can review your changes.

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

License

MIT © wangkezun

Forked from pages-store

origin repo depends on gh-pages which commit every thing in images folder to github. It's very slow and unsafe.

this repo depends on @octokit/rest which can commit one file a time, makes the upload much faster than origin adapter.

About

GitHub Pages Storage Adapter for Ghost

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.