Skip to content

Instantly share code, notes, and snippets.

View ErisDS's full-sized avatar

Hannah Wolfe ErisDS

View GitHub Profile
@ErisDS
ErisDS / custom-reading-time.html
Created May 22, 2020 18:03
Examples of how to implement a custom reading time with the Ghost Content API + SDK
<html>
<head>
<script src="https://unpkg.com/@tryghost/content-api@latest/umd/content-api.min.js"></script>
<script src="https://unpkg.com/@tryghost/helpers@1.1.27/umd/helpers.min.js"></script>
<script>
const api = new GhostContentAPI({
url: 'https://demo.ghost.io',
key: '22444f78447824223cefc48062',
version: "v3"
<html>
<head>
<script src="https://unpkg.com/@tryghost/content-api@latest/umd/content-api.min.js"></script>
<script>
const api = new GhostContentAPI({
url: 'https://demo.ghost.io',
key: '22444f78447824223cefc48062',
version: "v3"
});
  • Most linux distros have a package manager, see the Node.js guide for details on installing node via various package managers or alternatively it is possible to download the .tar.gz archive from http://nodejs.org
  • Double check that you have Node and npm installed and that you have the right version, by typing node -v and npm -v into a terminal window and comparing with the blue box above.

Install Ghost

  1. Grab the latest version of Ghost from Ghost.org:

    $ curl -L https://github.com/TryGhost/Ghost/releases/download/0.11.12/Ghost-0.11.12.zip -o ghost.zip

  2. Unzip Ghost into the folder /var/www/ghost (recommended install location):

@ErisDS
ErisDS / slimer.js
Created April 16, 2019 18:26
Extending sywac dynamically
#!/usr/bin/env node
const prettyCLI = require('@tryghost/pretty-cli');
const slimer = require('@tryghost/slimer');
const extensions = require('../extensions');
// Require internal commands
prettyCLI.commandDirectory('../commands');
slimer
.loadCommands()
@ErisDS
ErisDS / README.md
Created March 7, 2019 16:39
Ruby Example of Ghost JWT Auth

Demo of generating a JWT and authenticating with Ghost's Admin API.

Usage:

  • Save ghost-auth.rb locally
  • gem install httparty jwt first
  • With Ghost running on localhost:2368
  • ruby ghost-auth.rb {admin api key} to run

Gotchas:

@ErisDS
ErisDS / README.md
Last active June 15, 2023 01:13
Bash Example of Ghost JWT Auth

Demo of generating a JWT and authenticating with Ghost's Admin API.

Usage:

  • Save ghost-auth.sh locally
  • With Ghost running on localhost:2368
  • sh ghost-auth.sh {admin api key} to run

Gotchas:

@ErisDS
ErisDS / README.md
Last active January 14, 2023 15:26
Deployment tools for Ghost themes

Gulp tools to deploy a Ghost theme

To set it up:

  • copy gulp-config.json.example to gulp-config.json
  • enter the blog admin url, no trailing slash, e.g. https://myblog.ghost.io
  • grab the client secret for the frontend from the source of any page of the blog
  • enter the email address & password you use to login to the blog (must be administrator-level)

To deploy:

@ErisDS
ErisDS / changelog.md
Last active July 26, 2017 14:03 — forked from kevinansfield/changelog.md
Full 1.0.0 Changelog

Highlights

  • [New] A brand new editor based on Mobiledoc, using SimpleMDE & Markdown-it to recreate full markdown support
  • [New] Casper 2.0 - an overhaul that makes use of all of Ghost's best theme features
  • [New] Improved default posts, explaning more features and a welcome tour to guide users around
  • [New] Nightshift mode light text on a dark background for editing at night, available in labs
  • [New] Config with nconf, logging with bunyan, and debug output using debug.
  • [Improved] Publish menu which brings scheduling front and centre, instead of it being an after thought
  • [Improved] Simplified content screen with filtering makes it easier to find
  • [Improved] The importer has had a complete overhaul, is now more robust and outputs much, much better error & warning messages when things do go awry
@ErisDS
ErisDS / README.md
Last active November 5, 2017 02:19
Ansible tips for Ghost-Cli TODO: make this a proper repo

This assumes that you have already installed:

  • mariadb/mysql (no example provided)
  • node v6 (see node-install.yml)
  • ghost-cli latest (see ghost-cli-install.yml)
  • nginx (see nginx-install-config.yml)

After that, running install-ghost.yml will:

  • create you a db user (ghost cli may take this over in future)
@ErisDS
ErisDS / event_types.json
Created June 7, 2017 09:50
All Chargebee v2 Events as a JSON object.
[
{
"name": "plan_created",
"trigger": "Triggered when a plan is created",
"resources": ["plan"]
},
{
"name": "plan_updated",
"trigger": "Triggered when a plan is changed",
"resources": ["plan"]