Skip to content

Instantly share code, notes, and snippets.

View ErisDS's full-sized avatar

Hannah Wolfe ErisDS

View GitHub Profile
@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 / examples.md
Last active December 20, 2023 18:05
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 / 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 / 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"
@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);
<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()