stenix
stenix

Reputation: 3106

Apply GitHub pages theme on existing html

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

Upvotes: 4

Views: 1631

Answers (2)

Mr. Hugo
Mr. Hugo

Reputation: 12592

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

Upvotes: 5

marcanuy
marcanuy

Reputation: 23972

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.

Upvotes: 2

Related Questions