Jekyll without a theme
Asked Answered
A

1

19

I'm trying to create a static website. I want to be able to do some simple preprocessing, such as including one page within another, without the use of PHP or JavaScript.

Jekyll seemed perfect for this, especially given its support on GitHub pages.

However, after trying a few themes and trying to tweak them into what I'd like, I found myself fighting the themes which made them more of a hindrance than helpful. As a result, I decided to try and work without them and just use Jekyll as a fancy preprocessor and plugin platform (for things such as jekyll-redirect-from).

Much to my surprise, I couldn't find any information on how to do this, on how and where to place what files to generate a useable site. It feels like this should be incredibly simple to do, but the only route I've found so far is to create my own theme. This seems like overkill to me.

TL;DR

How can I create a Jekyll site without using a theme? Where can I find information on what files I need, where, what needs to be in them and so on?

Abeabeam answered 8/8, 2019 at 20:17 Comment(0)
T
33

You can invoke the jekyll new command with the --blank option as documented in the command line usage section of the docs.

That way Jekyll generates a basic project with empty folders and files.

Now start by creating your own layout in _layouts/my-fancy-layout.html:

<!DOCTYPE html>
<html>
  <head>
    <title>My Fancy Title</title>
  </head>
  <body>
    <p>Here comes my fancy content: </p>
    {{ content }}
  </body>
</html>

Next add some content to your index.html and tell it to use your layout:

---
layout: my-fancy-layout
---
<h1>Hello, World!</h1>

This is your basic Jekyll site with your custom layout :)

Further steps are:

By the way, I created my personal website that way and it works like a charm.

Tade answered 9/8, 2019 at 6:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.