Why is my completely new Jekyll blog blank when I add the supported Hacker theme?

246 views Asked by At

I am trying to get started with a Jekyll blog. I followed these instructions to setup the blog using the default minima theme. This actually worked without any problems, but I wanted to change to the Hacker theme. To do that it simply asks for the following changes to me _config.yml:

remote_theme: pages-themes/[email protected]
plugins:
- jekyll-remote-theme # add this line to the plugins list if you already have one

After making these changes I went to the URL https://galenseilis.github.io/ where I see that nothing renders anymore.

The current state can be observed at https://github.com/galenseilis/galenseilis.github.io, but everything should be the default values except where I made changes to the Gemfile and _config.yml. But since I may change the content of the repo as I troubleshoot, so here is a snapshot of these files:

Gemfile

source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
#     bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
# gem "jekyll", "~> 4.3.2"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
# gem "minima", "~> 2.5"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages",  group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.12"
end

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
  gem "tzinfo", ">= 1", "< 3"
  gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]

# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
# do not have a Java counterpart.
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]

_config.yml

title: Your awesome title
email: [email protected]
description: >- # this means to ignore newlines until "baseurl:"
  Write an awesome description for your new site here. You can edit this
  line in _config.yml. It will appear in your document head meta (for
  Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: jekyllrb
github_username:  jekyll

# Build settings
# theme: minima
# theme: jekyll-theme-hacker
remote_theme: pages-themes/[email protected]
plugins:
  - jekyll-feed
  - jekyll-remote-theme

Reverting the recommended changes for the Hacker theme back to the original state using minima theme returns the rending of the page. So maybe the changes I have made are insufficient if not incorrect somehow?

1

There are 1 answers

0
rio197 On

I was just converting my Minima to Hacker theme as well and ran into the same issue.

I finally got it working after reading the Hacker theme's repo as well as getting the following hint from another developer:

The Hacker theme has to have the _layouts directory containing the following files:

_layouts/home.html
_layouts/page.html
_layouts/post.html

The contents of page.html and post.html should be the same, for now at least:

---
layout: default
---
    
{{ content }}

The contents of the home.html page should be like the following i.e., you'd have to iterate on every file under the _posts directory:

---
layout: default
---

{{ content }}

{% if site.posts.size > 0 %}
<h2>Posts</h2>
<ul>
    {% for post in site.posts %}
    <li>
      <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
    </li>  
    {% endfor %}
</ul>
{% endif %}

The relative_url Liquid filter seems to do the trick of making available the files under the _posts directory.

Although, I would have a hard time explaining this solution since I am new to Jekyll myself!

Here is my website for reference: https://rio197.github.io/skills-github-pages/