Skip to content

"search.json" Fails to Load Due to Invalid Escape Sequence #2416

@ProphetHJK

Description

@ProphetHJK

Checklist

How did you create the site?

Generated from chirpy-starter

Describe the bug

When using Simple-Jekyll-Search, the browser console shows the following error:

SyntaxError: Bad escaped character in JSON at position 1473

As a result, the search feature does not work.

According to my speculation, this issue was introduced in commit 0eb7efa, which removed the jsonify filter from the Liquid template generating search.json:

"content": {{ _content | jsonify }}

Steps To Reproduce

  1. Include a blog post where the content field contains a Windows file path, e.g.,:

    ... set environment path to C:\Program Files\...
  2. Load the page, execute in console:

    fetch('/assets/js/data/search.json').then(r => r.json()).then(console.log).catch(console.error);

Expected Behavior

  • The search.json file should load successfully without throwing a SyntaxError.
  • All content, including Windows file paths (e.g., C:\Program Files...), should be correctly escaped and parsable as valid JSON.
  • Simple-Jekyll-Search should initialize properly and return relevant search results based on user input.

Environment

jekyll-theme-chirpy v7.3.0

Anything else?

search.json

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleasedIncluded or resolved in the release

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions