Skip to content

Commit

Permalink
fix search.data()
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Jun 18, 2024
1 parent 4d90424 commit 2969a7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Go to the `v1` branch to see the changelog of Lume 1.

## [2.2.2] - Unreleased
### Fixed
- `search.data()` doesn't return data for source files (like `search.data("index.md")`).
- esbuild plugin: Fixed `basename` support [#617].
- Apply `mergedKeys` configuration in layouts [#618].
- Extended Preact types with Lume's custom attributes [#619].
Expand Down
4 changes: 3 additions & 1 deletion core/searcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export default class Searcher {
return dirData as T & Partial<Data>;
}

const result = this.#pages.find((page) => page.data.url === normalized);
const result = this.#pages.find((page) =>
page.data.url === normalized || page.data.sourcePath === normalized
);

if (result) {
return result.data as T & Partial<Data>;
Expand Down

0 comments on commit 2969a7d

Please sign in to comment.