![]() The format that we need to translate to consists of two important parts: We can take a look at what the API response for each blog post looks like in these instructions. transform the post into the format required by docpad parse each of the posts in the response set total count, should only happen the first time * The looping is necessary, because you cannot download all posts at once * Here we do the queries, and be sure to set total so that it loops more than once ![]() Var wordpressSite = '' // replace with your own I would do that for maybe a couple of posts, but since I am dealing with about 80 posts here, and that is certainly going to be too time consuming of an endeavour! var pos, step, total With the API documentation in hand, we can now write some code to automate that - we certainly do not want to be issuing multiple wget or curl calls, and then copying the results from them into new files by hand. In order to get our posts, we can follow these instructions. There is almost no set up required, as no form or authentication is required. Wordpress exposes a JSON API that allows you to extract your posts. Now we have a shiny new NodeJs project ready to go, with batteries (dependencies) included. Npm install -save request mkdirp moment tumblr.jsĮdit index.js, and add the following: var fs = require('fs') Npm init #accept all the defaults, it isnot very important #Wordpress blog posts url extractor how toLet us take a look at how to extract data from tumblr and wordpress blogs, and transform it for docpad, a static site generator. In the previous post, I made the case for static site generation. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |