Netlify Ghost Markdown Build Plugin
This plugin generates posts and pages from a Ghost publication as markdown files, using the Ghost Content API. In addition it will copy images from the Ghost publication into a local assets directory. Pages, posts and images will be generated on the
onPreBuild event in the Netlify deployment cycle, this is to ensure the files are present before an actual build occurs.
Before you can use this package you'll need a Netlify project that can consume markdown files and images. This package was built with Jekyll in mind, however in theory it should work with any static site generator
To install, add the following lines to your
[[plugins]] package = "netlify-plugin-ghost-markdown" [plugins.inputs] ghostURL = "https://YOURGHOST.URL" ghostKey = "YOURGHOSTKEY"
[[plugins]] line is required for each plugin, even if you have other plugins in your
netlify.toml file already.
You'll need to get a Ghost Content API URL and key to authenticate with your Ghost publication. Please see the Ghost documentation for more info.
[[plugins]] package = "netlify-plugin-ghost-markdown" [plugins.inputs] # Required: Your Ghost domain, must not end in a trailing slash ghostURL = "https://YOURGHOST.URL" # Required: Content API key from the Integrations screen in Ghost Admin ghostKey = "YOURGHOSTKEY" # Optional: Directory containing image assets (assets/images by default) assetsDir = "./assets/images/" # Optional: Directory containing pages (site root by default) pagesDir = "./" # Optional: Directory containing posts (_posts/ directory by default) postsDir = "./_posts/" # Optional: Layout value for pages (page by default) pageLayout = "page" # Optional: Layout value for posts (post by default) postsLayout = "post" # Optional: Date prefix on post file names (true by default) postDatePrefix = true # Optional: File path and name for a timestamp caching file (_data/ghostMarkdownCache.json by default) cacheFile = "./_data/ghostMarkdownCache.json"
Currently posts follow the Jekyll markdown file name format. Set the
postDatePrefix to false to use the post slug as the file name
Testing inside the project is proving difficult at the minute. Currently requesting support on a practical method here
Clone project down
Install dependencies with
npm run devto clone the plugin into
Released under the MIT license.