Skip to content

Fix Jekyll build crash caused by nil-valued custom_social in socials.yml#2

Merged
jwtoney merged 2 commits into
mainfrom
copilot/fix-liquid-exception-in-about-layout
Feb 24, 2026
Merged

Fix Jekyll build crash caused by nil-valued custom_social in socials.yml#2
jwtoney merged 2 commits into
mainfrom
copilot/fix-liquid-exception-in-about-layout

Conversation

Copilot AI commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

The jekyll-socials gem crashes when iterating over social entries if any key maps to nil. Having custom_social: with all sub-keys commented out produces exactly that — a nil hash value — causing social[1]['logo'] to raise NoMethodError during build.

Change

  • _data/socials.yml: Commented out the custom_social: key itself (not just its sub-entries), so no nil-valued entry is passed to the gem.
# Before — key exists, value is nil:
custom_social:
  # logo: ...
  # title: ...
  # url: ...

# After — key absent entirely:
# custom_social:
#   logo: ...
#   title: ...
#   url: ...
Original prompt

The GitHub Actions job failed with a Liquid Exception: undefined method [] for nil in /home/runner/work/jwtoney.github.io/jwtoney.github.io/_layouts/about.liquid. To resolve this, update _layouts/about.liquid so that all array/hash accesses (e.g., {{ some_variable['key'] }}) are wrapped in existence checks. Any access like {{ x['y'] }} should be rewritten as:

{% if x and x['y'] %}
{{ x['y'] }}
{% endif %}

For example, if site.data.authors['jwtoney'] is used and site.data.authors or 'jwtoney' isn't guaranteed to exist, wrap them accordingly. This prevents Liquid from throwing an error when the variable is nil.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: jwtoney <123672274+jwtoney@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Liquid exception in about layout by adding existence checks Fix Jekyll build crash caused by nil-valued custom_social in socials.yml Feb 24, 2026
Copilot AI requested a review from jwtoney February 24, 2026 02:04
@jwtoney jwtoney marked this pull request as ready for review February 24, 2026 02:06
@jwtoney jwtoney merged commit 16f2bb6 into main Feb 24, 2026
4 of 5 checks passed
@jwtoney jwtoney deleted the copilot/fix-liquid-exception-in-about-layout branch February 24, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants