4

I have an existing GitHub project that already had a few html pages. Now I made a GitHub pages site of the project using the docs folder in the master branch but when I try to apply an existing jekyll theme to the pages, the theme is not applied. The docs folder contains a file named index.html.

Do I need to add some kind of import statement to my html pages or do I really need to convert them to markdown syntax? Maybe I am doing something wrong here?

The GitHub project is found here

The GitHub pages site for my project is here

stenix
  • 3,068
  • 2
  • 19
  • 30

2 Answers2

5

From a plain HTML website to a Jekyll website

If you want a plain html website to use layouts, you start your html pages with:

---
layout: page
---

You can freely rename your files from .html to .md, as it is allright for .md pages to contain HTML. Next you simply create your page.html layout file in the _layouts directory.


Using a Github pages theme

If you want to use a Github theme, you can download the theme and put the files in the root. You can achieve the same by just adding this sinlge line to your _config.yml:

theme: jekyll-theme-hacker

The theme name here is 'jekyll-theme-hacker'. Optionally, if you'd like to preview your site on your computer, add the following to your site's Gemfile:

gem "github-pages", group: :jekyll_plugins

Source: https://github.com/pages-themes/hacker#usage

Mr. Hugo
  • 11,887
  • 3
  • 42
  • 60
  • 2
    Is it mandatory to rename `*.html` to `*.md`? I don't think so. – seenukarthi Oct 08 '17 at 04:26
  • Well, that gave me layouts which is nice, but the question was how to make use of the themes of github pages. It was partly my mistake that the title was a bit miss-leading. I changed the title now. The _config.yml contains configuration for the theme but it still does not work. B.t.w I did not have to rename index.html to index.md, layouts works anyway as suggested by @KarthikeyanVaithilingam. – stenix Oct 08 '17 at 08:25
  • I have updated my answer. Thank you for your comments. – Mr. Hugo Oct 08 '17 at 21:14
2

If you have a _layouts directory containing files with the same name as the new theme layout files, they will have precedence over the theme files.

This is the way Jekyll makes it possible to customize themes.

In this case remove the _layouts directory and Github pages will use the desired theme.

marcanuy
  • 23,118
  • 9
  • 64
  • 113
  • 1
    I had to change to use the layout named "default" also since that was the layout that the theme slate used. Now it works. Thanks. It was actually a combination of this answer and @JoostS but this was the missing piece. – stenix Oct 09 '17 at 10:44