Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions _scripts/search.liquid.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const ninja = document.querySelector('ninja-keys');

// add the home and posts menu items
ninja.data = [
{%- for page in site.pages -%}
{%- if page.permalink == '/' -%}{%- assign about_title = page.title | strip -%}{%- endif -%}
{%- endfor -%}
{%- assign about_title = site.pages | where: "permalink", "/" | first.title | strip -%}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fix invalid first.title filter usage

Liquid treats the segment after | as a filter name, so first.title is parsed as an unknown filter and Jekyll will fail to render this template for any build that reaches it. To safely extract the home page title, you need to either assign the page first and read its title (e.g., {% assign about_page = ... | first %} then about_page.title) or use | map: "title" | first, otherwise the build breaks with “Unknown filter 'first.title'”.

Useful? React with 👍 / 👎.

{
id: "nav-{{ about_title | slugify }}",
title: "{{ about_title | truncatewords: 13 }}",
Expand Down
Loading