6

How do I get Jekyll to work with Pow?

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
ma11hew28
  • 121,420
  • 116
  • 450
  • 651

3 Answers3

15

Thanks to the @mipadi answer, I learned that Pow automatically serves static files in the public directory of your application, so just configure Jekyll to change the directory where Jekyll will write files to from _site (the default) to public. Since public doesn't start with an underscore (_), you also have to add it to the list of files & directories to exclude. The relevant parts of my _config.yaml look like this:

destination: public
exclude: ["CNAME", "Rakefile", "README.md", "public"]

Then, just do the usual:

cd ~/.pow
ln -s /path/to/myjekyllsite

And navigate to http://myjekyllsite.dev/.

Pow public directory trailing slash issue: Going to http://myjekyllsite.dev/projects should automatically redirect to http://myjekyllsite.dev/projects/ but didn't.

Community
  • 1
  • 1
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
  • I still haven't been able to get this to work, even configuring Jekyll to compile to the 'public' directory. I get 404s or Chrome just uses a search engine to look for myjekyllsite.dev. Also, this is made even more messy if you have a Jekyll site that runs on Github Pages. username.github.com.dev confuses it. You'll have to create an alias when you symlink. – Kevin Suttle Nov 16 '12 at 20:45
  • Edit: Uninstalled pow, reinstalled pow, works fine now. The proverbial jiggling of the handle at work once again. – Kevin Suttle Nov 16 '12 at 21:03
  • I'm justing getting started with Jekyll and Pow, it works for me to use the `destination: public` and then symlink with Pow. Mipadi's link points to the Pow 2.4 Serving Static Files. At first, I had the 404 and that's because I had the `jekyll --server` running, once I stopped jekyll the Pow serving took over and I'm 200! – kaplan May 01 '13 at 03:31
  • After setting `destination: public` in your config.yml make sure to run jekyll build – Flov Nov 07 '15 at 22:23
9

Here's an approach that doesn't require overriding any of the normal Jekyll defaults:

Install rack-jekyll:

gem install rack-jekyll

Add config.ru with the following contents:

require "rack/jekyll"
run Rack::Jekyll.new

And now symlink your project directory into ~/.pow as you normally would.

John
  • 29,546
  • 11
  • 78
  • 79
1

I'm not familiar with Pow, but it looks like you could just symlink the output of your Jekyll-generated site into ~/.pow/public.

mipadi
  • 398,885
  • 90
  • 523
  • 479