Bruce Adams
Bruce Adams

Reputation: 5591

separate theme from content in jekyll?

As indicated in this similar question (Switch theme in an existing Jekyll installation) there are many jekyll themes to choose from. I would like to keep my own content separate from the jekyll theme used.

Is there a good (standard?) way of structuring a jekyll project so that your content can be kept distinct from the theme?

Most of your content is kept separate but there is a little bleedover. This is evident from the answer to the linked question. Changing the theme later can become a painpoint.

Ideally I would like to structure the project such that there is a theme sub-directory or similar and the theme may be altered by pointing at a different sub-directory. Doing this dynamically (making the web-site 'skinnable' would be nice to have but not essentiall).

Is there a dynamic theme theme somewhere?

Upvotes: 2

Views: 512

Answers (2)

user8616743
user8616743

Reputation:

Short answer: Yes, you can keep theme and content separate, but only if your site stays with the basic layout calls (default, page, post).

Longer explanation and exceptions: If your existing jekyll installation is pure: you have edited only the content in pages, posts and not created-used special layouts, then, you can use the jekyll-remote-theme plugin and the switch is seamless, assuming that the new theme is not doing something radical with the defaults.

If your existing theme has special layouts (e.g., splash.html and the new one does not have it) then your pages that employ the respective layout will become orphans (i.e., basic html with no special formatting).

I have switched an existing installation that had been extensively edited, so I got several orphan pages, which I had to manually switch to a layout that makes sense within the new theme.

In conclusion, you can keep content and theme separate in many common cases (e.g., personal blog), but not if you want a custom solution (e.g., personal portfolio with gallery and splash pages).

Upvotes: 1

SACn
SACn

Reputation: 1924

Jekyll is tool that allow content separation beautifully, be it also from theme files. It's not about standard structuring - although following points will help out.

  1. Do not move or disturb structure of theme files as it may be bought from 3rd party.
  2. Create content as blocks and put jekyll code to insert them at runtime in theme. So if you want header somewhere you can insert {% include head.html %}. Also have a look at contentblocks plugin.

Upvotes: 0

Related Questions