{"id":42863986,"url":"https://github.com/wkentdag/spike-wordpress","last_synced_at":"2026-01-30T12:42:39.321Z","repository":{"id":57367492,"uuid":"66226892","full_name":"wkentdag/spike-wordpress","owner":"wkentdag","description":"wordpress plugin for spike","archived":false,"fork":false,"pushed_at":"2023-12-25T14:14:22.000Z","size":351,"stargazers_count":8,"open_issues_count":25,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T09:30:05.590Z","etag":null,"topics":["spike","static-site-generator","wordpress"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/spike-wordpress","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wkentdag.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-22T00:12:46.000Z","updated_at":"2023-08-27T19:04:53.000Z","dependencies_parsed_at":"2023-12-25T16:01:03.635Z","dependency_job_id":"ac40fa64-228c-470a-b59e-159413bc4b60","html_url":"https://github.com/wkentdag/spike-wordpress","commit_stats":{"total_commits":61,"total_committers":2,"mean_commits":30.5,"dds":0.08196721311475408,"last_synced_commit":"68d5253ab4c72ead1bd329052d064a4df13e1032"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/wkentdag/spike-wordpress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkentdag%2Fspike-wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkentdag%2Fspike-wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkentdag%2Fspike-wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkentdag%2Fspike-wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wkentdag","download_url":"https://codeload.github.com/wkentdag/spike-wordpress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkentdag%2Fspike-wordpress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28912915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["spike","static-site-generator","wordpress"],"created_at":"2026-01-30T12:42:39.174Z","updated_at":"2026-01-30T12:42:39.314Z","avatar_url":"https://github.com/wkentdag.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"spike wordpress\n================\n\n[![npm](https://img.shields.io/npm/v/spike-wordpress.svg?style=flat)](https://www.npmjs.com/package/spike-wordpress) [![tests](https://img.shields.io/travis/wkentdag/spike-wordpress/master.svg?style=flat)](https://travis-ci.org/wkentdag/spike-wordpress) [![dependencies](https://david-dm.org/wkentdag/spike-wordpress.svg)](https://david-dm.org/wkentdag/spike-wordpress) [![Coverage Status](https://img.shields.io/coveralls/wkentdag/spike-wordpress.svg?style=flat)](https://coveralls.io/r/wkentdag/spike-wordpress?branch=master)\n\nuse wordpress as a backend for your [spike](https://www.spike.cf/) static project\n\n### installation\n```sh\nnpm i -S spike-wordpress\n```\n\n### setup\n\n- create a wordpress site (self-hosted or on wordpress.com)\n  - check the 1click wordpress app on [digital ocean](https://m.do.co/c/6e3837272e2f) for a quick cheap self-hosted option\n- install and activate wordpress [jetpack](https://wordpress.org/plugins/jetpack/) plugin\n- make sure the \"JSON API\" feature is turned on within jetpack\n- :beers:\n\n\u003e check out [this video](https://www.youtube.com/watch?v=gdWZ0Bpvmw4) demonstrating how you can easily set up a wordpress-powered static site that recompiles whenever you publish a new post or push to github using  [roots-wordpress](https://github.com/carrot/roots-wordpress), which this project is based on :eyes:\n\n### usage\nadd the plugin to your `app.js` file...\n\n```js\n//  app.js\n\nconst Wordpress = require('spike-wordpress')\nconst standard = require('reshape-standard')\nconst locals = {}\n\nmodule.exports = {\n  plugins: [\n    new Wordpress({\n      site: 'my_wordpress_site.com',\n      addDataTo: locals\n    })\n  ],\n  reshape: standard({ locals }),\n  // ...other config...\n}\n```\n\n...and then access your posts as local variables in your view files:\n\n```jade\n//  some_template.sgr\n\nextends(src='layout.sgr')\n  block(name='content')\n    h1 My awesome static blog\n\n    h2 Recent posts\n    .recent\n      each(loop='post, i in wordpress.posts')\n        if(condition='i \u003c 10')\n          h1 {{ post.title }}\n          h2 {{ post.excerpt }}\n          h3 by {{ post.author.name }} on {{ post.date }}\n```\n\n### features\n\n\n- [x] pass posts to locals\n- [x] [filter results with query params](#filter-results-with-query-params)\n- [x] [transform function](#transform-function)\n- [x] [render posts to a view template](#render-posts-to-a-template)\n- [x] [save output to json](#save-output-to-json)\n- [x] [`postTransform` hook](#posttransform-hook)\n\n**PRs welcome for new features!**\n\n#### filter results with query params\n\nby default the plugin dumps  all your posts into a single `wordpress.posts` array in the view locals, but you can configure multiple queries in the `posts` config key. pass in an array of config objects with a `name` (required, so that you can access it in your locals at `wordpress[name]`) and any parameter supported by the [wordpress v1 api](https://developer.wordpress.com/docs/api/1/get/sites/%24site/posts/):\n\n```js\nconst locals = {}\nnew Wordpress({\n  name: 'my_wordpress_site',\n  addDataTo: locals,\n  posts: [\n    {\n      name: 'posts'\n      number: '10'  //  default limit is 20, max is 100\n    },\n    {\n      name: 'interviews',\n      category: 'interview',\n      order: 'ASC',\n      search: 'some text'\n    }\n  ]\n})\n\n```\n\n#### transform function\n\nyou can also include an arbitrary `transform` function to apply to posts on the fly during the build process (see [postTransform hook](#posttransform-hooks) if you want to manipulate your locals after they've already been processed):\n\n```js\nnew Wordpress({\n  name: 'my_wordpress_site',\n  addDataTo: locals,\n  posts: [{\n    name: 'funtimes',\n    transform: (post) =\u003e {\n      post.foo = 'bar'\n      return post\n    }\n  }]\n})\n```\n\nposts are run through a generic transform function by default; you can pass `transform: false` to bypass it and return the raw result\n\n#### render posts to a template\n\nyou can add an optional `template` param that will render each item in `posts[param]`\nto a specific view template with a configurable output path:\n\n```js\nconst locals = {}\nnew Wordpress({\n  name: 'my_wordpress_site',\n  addDataTo: locals,\n  posts: [{\n    name: 'portfolio',\n    template: {\n      path: 'views/portfolio-item.sgr',\n      output: (item) =\u003e `posts/${item.slug}.html`\n    }\n  }]\n})\n```\n\nAny post that gets rendered to a template gets a convenient `_url` key tacked on as well (the result of the `output` function you must pass):\n\n```jade\n//  portfolio-item.sgr\n\na(href={{ item._url }})\n  h1 {{ item.title }}\n  img(src={{ item.featured_image }})\n  p {{ item.content }}\n```\n\n\n#### save output to json\n\npass a file name to the `json` param to write the `locals.wordpress` output to:\n\n```js\nconst locals = {}\nnew Wordpress({\n  name: 'my_wordpress_site',\n  addDataTo: locals,\n  json: 'data.json'\n})\n\n```\n\n\n#### postTransform hook\n\nadd a `postTransform` hook to modify posts and locals before\nyour templates get compiled, but *after* each `post`'s (optional) `transform` function runs:\n\n```js\nconst fs = require('fs')\nconst locals = {}\nnew Wordpress({\n  name: 'my_wordpress_site',\n  addDataTo: locals,\n  posts: [{\n    name: 'posts',\n    transform: (post) =\u003e {  // this runs first...\n      return post.title\n    }\n  }],\n  hooks: {\n    postTransform: (posts, locals) =\u003e {\n      posts.map(p =\u003e p.toUpperCase())\n      return [posts, locals] //  posts = ['TITLE1', 'TITLE 2', etc]\n    }\n  }\n})\n```\n\n### testing\n\nThe tests depend on a jetpack-enabled test wordpress instance.\nIf you are developing a new feature and want to run the test suite either submit a PR (they'll be auto run by travis), or file an issue and I'll get you access to the test server :)\n\n```sh\n# install module dependencies\nnpm i\n\n# create a config file from the boilerplate\nmv .env.sample .env\n\n# run the tests\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwkentdag%2Fspike-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwkentdag%2Fspike-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwkentdag%2Fspike-wordpress/lists"}