Jump to Content
welcome to my brain. come, have a seat.

{ Email Connor }

Welcome to the blog of Connor Boyack, a 20-something husband, web designer, Latter-day Saint, constitutionalist, paleocon, classical liberal, preparedness practitioner, budding philanthropist, and master's student of political economy. I'm from Poway, CA but live in Happy Valley.


blog RSS feed

Making a Blook with Wordpress and Pages

Posted by Connor on January 27th, 2007

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

For a few months now, I’ve wanted to create a blook (blog + book) from the posts I’ve written in 2006 (something like the Lifehacker book). I’ve been waiting for Blurb to get around to it, but their application can only import wordpress blogs that are hosted on wordpress.com. Since my blog is hosted remotely, that’s a no go. I exchanged a couple emails with somebody at their company who informed me that sometime in 2007 their program would have the ability to import all wordpress blogs, regardless of the hosting situation.

I’m not a patient person.

And so, when I was reminded about my blook desire after reading Ben’s post, I decided to put off the ~10 other things I was supposed to do today (except for attending the temple, of course) and write my own script to do just this.

Here’s what the script does:

  1. At the top you enter the necessary data to connect to your wordpress database as well as a starting and ending date for running the query.
  2. The script will then extract all posts and comments between the given date range.
  3. All links are removed from the posts and comments, leaving just the words that were linked along with a footnote mark. After the post/comment, a list of the links (with their corresponding footnote numbers) is printed.
  4. All embedded youtube and google videos are removed. The script replaces the video with the text {VIDEO: http://urlOfVideo}.
  5. CSS classes are assigned to the post title, date text, links and comment titles, and link list. This allows you to change all global styles in Pages (or a similar app), so that if you want to change all your post titles to red, you can change it once and be done.

Once you’ve configured the script as you want it, upload it somewhere and pull it up in your browser. What you should see is the dump of all the posts/comments in the date range you specified.

I then saved the HTML file to my local machine and opened it up in Pages. I’m sure other programs would work fine as well, but I prefer Pages over Word, and don’t know InDesign all that well.

Opening the file might take a while, depending on the number of posts/comments you extracted. Once the file was open I styled the imported CSS styles as I liked them, applying them globally. To do this, go to View -> Show Styles Drawer. As an example, reformat one of the post titles as you want it, then click on the arrow to the right of the style named “title”. From the drop down, select “Redefine Style From Selection”. This should change all the post titles in the document. Rinse and repeat for other styles as desired.

Pages didn’t import floated elements correctly, so I had to manually format my images so that they floated the text around them.

Once it’s formatted as you want it, simply export it as a PDF and use a service such as Lulu to print!

Download: blook.zip - unzip, remove .txt extension, and upload to your server after configuring.

Enjoy! If you come across any bugs please let me know. Also feel free to modify the script to your heart’s content. It’s license-free. Yum!

UPDATE: This script is now UTF8-compliant and will work for all Wordpress blogs, including those that require UTF8. Thanks to Ken.

Possibly related posts:

21 comments so far. Care to chime in?

Hmmm.. Apparently lulu.com has an upper limit of 740 pages for its books. My posts from 2006 (with comments) ended up being 1328 pages long. Drat.

#1 Connor on January 27th, 2007

Connor

Your post leaves me absolutely in the dark as I have no idea what you are talking about, and am therefore speechless.

#2 Michael L. Mc Kee on January 27th, 2007

Michael,

You’ll have to forgive the indulgence of my nerdy side, something I don’t show too often on this blog, as I tend to stick to political/religious topics. I promise it’ll be a long time before I post something technical again. :)

#3 Connor on January 27th, 2007

Don’t worry, some of us out here like reading the nerdy stuff :)

#4 mmathson on January 27th, 2007

[...] Boyack has released a pretty good interesting plugin yesterday in his blog. It basically pulls all the posts you have on a stand-alone wordpress install [...]

#5 Novelr.com - Making People Read - » Blook Plugin on January 28th, 2007

Connor,

This is awesome. I’m trying it out. If you don’t mind, I’ll probably send you a tech support question or two. ;) I’m a newbie.

#6 Carolynn Duncan on January 29th, 2007

I just tried to download the script but I’m getting a mysql_connect() error.

Could you fix this so I can get your script?

Thanks!

Nathan

#7 Nathan on November 22nd, 2007

Nathan, the link has been updated to point to a zip file instead. Save that to your computer and that should be usable.

#8 Connor on November 22nd, 2007

[...] personally recommend Connor Boyack’s blooking script, which extracts posts from a specified date range and wraps the relevant blocks in CSS styles that [...]

#9 Blooking : Simplicitas | Ken Liu on January 28th, 2008

Does this work with Blogger?

#10 m&m on January 29th, 2008

M&M,

As the post notes, this is only for Wordpress. :) Hosted blogs (on blogspot.com and wordpress.com) prevent access to the full database, and usually only allow you to export the data in a proprietary format that would have to be parsed through… A project for someone else, perhaps. :)

#11 Connor on January 29th, 2008

sorry…missed that. Obviously, I’m not a techie. I finally get it, though.

#12 m&m on January 29th, 2008

I clinked the link and was sent to a garbled page … is this script still available? I am very interested in trying it out :) Thanks

#13 chelle on February 21st, 2008

I’ve updated the link - should be working now.

#14 Connor on February 21st, 2008

lol ok, I think I must be doing something wrong … I click and it WORKS! w00t and then I am …. what the … hehe Thanks for updating the link. I look forward to playing around with the script! Seriously thought I was going crazy loco!

#15 chelle on February 21st, 2008

I see my husband left a comment above — that was a long time ago now. :-)

Just wanted to thank you for the script you wrote! I saw a blook service on a friend’s page but it used Blogger — so I asked around to my technologically-gifted friends and my brother Alex quickly got back to me with this post. My husband (Nathan) then used your script to print out my blog. It was the best birthday present ever — I am so excited! Thanks so much for sharing this!

Already a few of my blogger-friends with Wordpress have asked about it — I am referring them over here. Thanks!

#16 Beth on February 22nd, 2008

Thanks for the script… worked like a charm on my wife’s blog. Just submitted a 490 page blook of our family to Lulu.

Lulu wouldn’t accept the PDF exported by Pages (lulu evidently doesn’t support the Mac 10.4.11 PDF encoding from Pages 08). I re-uploaded as a .doc, and worked fine. Odd.

I’ve been trying to accomplish this seemingly simple task for about 3 months. Thanks a million!
John

#17 John on March 3rd, 2008

[...] to add the link to Connor Boyack’s post regarding the script — this is actually what we used, though keep in mind that Nathan tweaked the code a bit to [...]

#18 Daisy Chain » Birthday Present on April 30th, 2008

[...] Connor’s Conundrums » Making a Blook with Wordpress and Pages (tags: blogging books wordpress) [...]

#19 O’DonnellWeb - This is not a homeschooling blog » Blog Archive » links for 2008-06-17 on June 17th, 2008

Thanks so much for posting this!!!!! You saved me a TON of work. You’re great. The only glitch I ran into was that lulu wouldn’t accept a Pages document nor would it accept a PDF that was created from Pages. So, I had to export my Pages document as a Word document and then it worked fine.

#20 Karl on July 11th, 2008

So, is there an easy way to do this for wordpress.com blogs? Or should I just covert to wordpress.org… since I know I will eventually someday anyways…

#21 Jeff T. on October 17th, 2008

Post a comment

Name (required)

Email (required)

URL

what's new

Featuring 615 posts w/ 7,586 comments.

Search the blog
[ Sitemap ]
Recent Comments RSS feed
Most Commented
Recent Posts
Aaaaarchives