Fix: protect search-data.json file from front matter default for layout (#1468)

Fixes #1466. Prior art: #1447. Otherwise self-explanatory.

To test:

1. First, clone [template repository](https://github.com/just-the-docs/just-the-docs-template/tree/main). Observe that search works.
2. Next, add a default layout to all files
```yml
defaults:
  - scope:
      path: ""
    values:
      layout: "default"
```
3. Observe that search no longer works.
4. Apply this patch
5. Observe that search works again!
This commit is contained in:
Matt Wang
2024-05-15 17:06:27 -07:00
committed by GitHub
parent 1b79df8ebb
commit 2dd535c2da
3 changed files with 5 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ namespace :search do
File.open('assets/js/zzzz-search-data.json', 'w') do |f|
f.puts '---
layout: null
permalink: /assets/js/search-data.json
---
{