Alexander Stippler
Alexander Stippler

Reputation: 73

Integrating rails into jekyll

I'm new to rails. I already set up some pages with jekyll. Now I want to combine the two things. First approach: bloggy.

I have to set up a homepage for a sports club so I need:

With bloggy I have jekyll integrated but still somewhat separated from rails. Now the question. How can I use jekyll (I really like it) and use e.g.

<%= stylesheet_link_tag    "application", :media => "all" %>

or other rails specific things in jekyll posts.

Any suggestions? Am I misunderstanding some concepts in general?

Upvotes: 1

Views: 545

Answers (1)

Alan W. Smith
Alan W. Smith

Reputation: 25425

You are trying to do something outside the scope of jekyll (and bloggy). Specifically, you're trying to use jekyll to create a dynamic page.

I haven't used bloggy, but use jekyll for my site. From the way I understand the bloggy overview, effectively all it does is push jekyll's output into the 'public' directory of your rails app. The files are still served in a completely static manner. There may be a way to have rails run some process over the 'public' files, but that would be working at cross purposes. Use Rails for anything that needs to have any level of server side dynamic processing. Use Jekyll for anything that can be fully baked and served as a flat file with zero server side dynamic processing. (Of course, Rails can server flat files, but jekyll doesn't have a server side processing component.)

All that said, depending on what you're trying to do, client-side dynamic actions are absolutely in scope for jekyll. For example, using javascript to determine client characteristics and calling an appropriate style sheet. So, either setup your rails app to do render any file that needs dynamic output or figure out a way to do it with javascript.


As an aside: If you think the best approach it to use jekyll, you could have it only generate the content areas for each page (e.g. only the <body> or specific <div> tags) and then include those sections inside rails which would be responsible for the wrapper of the page. That seems like it would be adding overhead, but I'm sure it could be made to work.

Upvotes: 1

Related Questions