chriszarate / wordpress-com-static-site-generator

Static site generator using WordPress.com REST API as a data source

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WordPress.com Static Site Generator

This is a simple static site generator that uses the wordpress.com REST API as a backend and publishes to an AWS S3 bucket. If you use CloudFront to serve / terminate TLS, it will issue an invalidation request.

It uses AWS API Gateway to provide a webhook, which is called whenever you publish or update a post (or page) on wordpress.com. It will look a lot like my blog, because that's what it is.

  1. Copy config.example.js to config.js and edit it.

  2. Create the webhook on AWS:

npm run setup
  1. Give the Lambda function permission to write to your S3 bucket.
npm run policy
  1. Add the webhook to your wordpress.com site for the following events:
publish_post
publish_page

Updating manually

When running locally, make sure your AWS credentials are available.

npm run publish

Alternatively, you can just POST to your endpoint:

curl -X POST https://API_GATEWAY_ID.execute-api.AWS_REGION.amazonaws.com/latest/update

About

Static site generator using WordPress.com REST API as a data source


Languages

Language:HTML 52.2%Language:JavaScript 47.8%