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"
});
@ErisDS
ErisDS / gist:e5613fc5c1e03204ab52
Created February 17, 2015 17:01
editor test fail
Test file: /home/travis/build/TryGhost/Ghost/core/test/functional/client/editor_test.js
PASS Ghost editor functions correctly (20 tests)
PASS Image Uploads (24 tests)
# type: fail
# file: /home/travis/build/TryGhost/Ghost/core/test/functional/client/editor_test.js
# subject: false
<!DOCTYPE html><!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]--><!--[if (gte IE 9)| IEMobile |!(IE)]><!--><html class="no-js desktop landscape" lang="en"><!--<![endif]--><head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Editor - Test Blog</title>
@ErisDS
ErisDS / examples.md
Last active May 2, 2024 08:23
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

@ErisDS
ErisDS / http-store.js
Last active March 22, 2024 16:38
HTTP Store, Storage layer for Ghost 0.6.0 - passes images to a HTTP endpoint
var _ = require('lodash'),
fs = require('fs-extra'),
http = require('http'),
path = require('path'),
util = require('util'),
Promise = require('bluebird'),
options = {},
mimeTypes = {
@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 / style-test.md
Last active November 25, 2020 12:03
A Full and Comprehensive Style Test

Below is just about everything you'll need to style in the theme. Check the source code to see the many embedded elements within paragraphs.


Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6
@ErisDS
ErisDS / stackPrinter.js
Last active April 24, 2020 15:12
Print an express middleware stack
module.exports = function stackPrinter(req, res, next) {
console.log('Printing Stack For', req.url);
function printItem(item, prefix) {
prefix = prefix || '';
if (item.route) {
console.log(prefix, 'Route', item.route.path);
} else if (item.name === '<anonymous>') {
console.log(prefix, item.name, item.handle);
  • 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):