Site.header_pages returns null inspite of header_pages being defined in _config.yml

I’m have forked this template - GitHub - nicolas-van/bootstrap-4-github-pages: A Bootstrap 4 template project for Github Pages and Jekyll to build a static site on GH Pages. It makes use of a variable called header_pages defined in _config.yml. After trying to use the variable and finding that it wasn’t being used I debugged the issue and spat out the site variable only to discover that site.header_pages is null. I tried defining another variable called some_list and set its values to the same values as header_pages and the values showed up in the site variable in the template (site.some_list contains the list of values). I am using the configuration shown in the repository linked above, and the only change to it is that I had to restrict the ffi gem to “< 1.17.0” because of some errors I was seeing with newer versions of ffi. But the only entry besides that in Gemfile is gem "github-pages", group: :jekyll_plugins. So I’m not using any plugins besides the ones that github pages uses. The version of jekyll is 3.9.5. Should I file this as a bug in github issues? I was going to file a bug, but the bug report system suggested that I should ask on this site first, in case this might be an issue with some plugin or something else and not with Jekyll core.

you’re sure you are restarting jekyll after any changes to the config file? they aren’t picked up while jekyll serve is running.

yes i wanted to mention that in my post. i read that in some other post, that jekyll serve doesn’t pick up changes in _config.yml. Yes i have restarted the server after making changes to _config.yml. And I’m able to see site.some_list after making changes and restarting it, but I’m just not able to see site.header_pages, or rather it’s value is set to null. Which is a strange thing, because if it was not being picked up, then it shouldn’t exist in the site object at all, but it appears in the site object, but its value is null, even though it has a list of items in _config.yml

maybe your yaml is invalid? try it with a simple string?

maybe you have the variable listed twice?

This is my _config.yml:

# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
#
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.

# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
title: Center for Community Dialog and Change - Conference Website
email: ""
description: >- # this means to ignore newlines until "baseurl:"
  Static website for CCDC's upcoming conference in December 2024
#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

repository: "ccdcin/ccdcin.github.io"

header_pages:
  - about.md
  - schedule.md

some_list:
  - about.md
  - schedule.md

# Build settings
plugins:
  - jekyll-feed
  - jekyll-sitemap

# A list of the pages to display in the navigation bar
header_pages:

# Exclude from processing.
# The following items will not be processed, by default. Create a custom list
# to override the default setting.
exclude:
  - Gemfile
  - Gemfile.lock
  - node_modules
  - update_boostrap.sh

You can see that header_pages and some_list have the same values. Neither variable is being repeated, yet site.some_list contains an array of those 2 elements while site.header_pages does not.

This is my _config.yml:

# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
#
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.

# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
title: Center for Community Dialog and Change - Conference Website
email: ""
description: >- # this means to ignore newlines until "baseurl:"
  Static website for CCDC's upcoming conference in December 2024
#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

repository: "ccdcin/ccdcin.github.io"

header_pages:
  - about.md
  - schedule.md

some_list:
  - about.md
  - schedule.md

# Build settings
plugins:
  - jekyll-feed
  - jekyll-sitemap

# A list of the pages to display in the navigation bar
header_pages:

# Exclude from processing.
# The following items will not be processed, by default. Create a custom list
# to override the default setting.
exclude:
  - Gemfile
  - Gemfile.lock
  - node_modules
  - update_boostrap.sh

You can see that both header_pages and some_list have the same values, and they aren’t being defined twice. Yet site.some_list contains the 2 elements in it, but site.header_pages does not.

I posted my _config.yml here but the Akismet bot has flagged the post, maybe because of links in my config.yml or whatever I’m not sure. But yeah, I’ve double checked the _config.yml and there are two variables defined right next to each other header_pages: and some_list: and they have the same values 2 items with file names. But only site.some_list has the values whereas site.header_pages is null in the templates

The _config.yml file that you posted does have the variable listed twice: the second instance is beneath the comment # A list of the pages to display in the navigation bar. If you remove that, can you access the values you need?

Oh my god I feel so stupid! I didn’t spot that at all. Yes that was the issue, removing the other entry fixed the issue.
Thanks,

I’m happy to help out!