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] ghostURL = "https://YOURGHOST.URL" ghostKey = "YOURGHOSTKEY" # Optionally set a directory for images assetsDir = "./assets/images/" # Optionally set a directory for pages pagesDir = "./" # Optionally set a directory for posts postsDir = "./_posts/" # Optionally remove the date prefix from post filenames postDatePrefix = true
Currently posts follow the Jekyll markdown file name format. Set the
postDatePrefix to false to use the post slug as the file name
Create a testing project using a static site generator like Jekyll:
gem install bundler jekyll jekyll new my-awesome-site
Move into that project,
Clone this repo into a
_pluginsdirectory using the following:
git clone firstname.lastname@example.org:daviddarnes/netlify-plugin-ghost-markdown.git _netlify-plugin-ghost-markdown
Move into the plugin directory,
Create a new
netlify.tomlfile with the following:
[[plugins]] package = "_netlify-plugin-ghost-markdown" [plugins.inputs] ghostURL = "https://YOURGHOST.URL" ghostKey = "YOURGHOSTKEY" # Remember to get your Ghost API credentials
Released under the MIT license.