Fix: Use valid Liquid filter to find home page title#3452
Fix: Use valid Liquid filter to find home page title#3452google-labs-jules[bot] wants to merge 2 commits intomainfrom
Conversation
Replaced an inefficient `for` loop in `_scripts/search.liquid.js` with a more performant Liquid `where` filter to find the home page title. This change improves the build-time performance of the site.
Replaced an inefficient `for` loop in `_scripts/search.liquid.js` with a more performant and syntactically correct Liquid `where` and `map` filter to find the home page title. This addresses a bug introduced in a previous refactoring attempt where the invalid `first.title` filter was used, which would cause a Jekyll build error.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
❌ Deploy Preview for relaxed-lollipop-b6bc17 failed. Why did it fail? →
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18eb683a49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| {%- 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 -%} |
There was a problem hiding this comment.
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 👍 / 👎.
Corrected the Liquid filter in
_scripts/search.liquid.jsto use the validmap: "title" | firstsyntax, resolving a bug that would have caused the Jekyll build to fail. This change addresses the feedback from the code review and ensures the refactoring is both efficient and correct.PR created automatically by Jules for task 5748098109809984605 started by @alshedivat