1
votes

I am building a simple static site as my personal website with Jekyll. I am using GitHub pages for hosting it (https://username.github.io). Recently I am trying to incorporate my custom domain with it and facing a problem.

For example, I have a page titled posts.html whose content is like this:

---
layout: page
title: Posts
permalink: posts
---

Some Text

<ul>
    {% for post in site.posts %}
        <li> List item </li>
    {% endfor %}
</ul>

Previously everything was appearing as expected. But after incorporating custom domain no list item is appearing(even though everything is perfect when I run locally). I suppose site.posts is appearing empty. Any suggestion why is?

I have another page like following which loops through something other than site.posts. It is appearing perfect even after incorporating custom domain.

---
layout: page
title: Books I Have Read
permalink: read-books
---

Some text

<ul>
    {% for book in site.data.read-books %}
        <li>
            <a href={{book.goodreads}}> {{book.title}} </a>;
            {{book.author}} [{{book.date}}]
            {% if book.comment %}
                <br/>
                (Opinion: {{book.comment}})
            {% endif %}
        </li>
    {% endfor %}
</ul>

Format of my posts: YYYY-MM-DD-title.md

Name of posts directory: _posts

Local Jekyll version is: 3.7.0

_config.yml content:

Title: Md. Taufique Hussain
brieftitle: Taufique
baseUrl: ""
# Where things are
source:          .
destination:     ./_site
collections_dir: .
plugins_dir:     _plugins
layouts_dir:     _layouts
data_dir:        _data
includes_dir:    _includes
collections:
  posts:
    output:   true

# Handling Reading
safe:                 false
include:              [".htaccess"]
exclude:              ["Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"]
keep_files:           [".git", ".svn"]
encoding:             "utf-8"
markdown_ext:         "markdown,mkdown,mkdn,mkd,md"
strict_front_matter: false

# Filtering Content
show_drafts: null
limit_posts: 0
future:      false
unpublished: false

# Plugins
whitelist: []
plugins:
    - jekyll-seo-tag

# Conversion
markdown:    kramdown
highlighter: rouge
lsi:         false
excerpt_separator: "\n\n"
incremental: false

# Serving
detach:  false
port:    4000
host:    127.0.0.1
baseurl: "" # does not include hostname
show_dir_listing: false

# Outputting
permalink:     date
paginate_path: /page:num
timezone:      null

quiet:    false
verbose:  false
defaults: []

liquid:
  error_mode: warn

# Markdown Processors
rdiscount:
  extensions: []

redcarpet:
  extensions: []

kramdown:
  auto_ids:       true
  entity_output:  as_char
  toc_levels:     1..6
  smart_quotes:   lsquo,rsquo,ldquo,rdquo
  input:          GFM
  hard_wrap:      false
  footnote_nr:    1
1
What does your browser's debugging console say..?ashmaroli

1 Answers

2
votes

First is you want to locally test Jekyll in Github Pages configuration, your Gemfile must contain :

source "https://rubygems.org"
gem 'github-pages'

All plugins available on gh pages will be loaded, see complete list here.

This will allow you to reproduce gh pages error which comes from one of your config directive :

collections_dir: .

If you delete or comment this directive everything is back to normal.