Skip to content

Commit

Permalink
fix nav plugin with Japanese characters
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Oct 12, 2024
1 parent 03decea commit 94b290b
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/),
and this project try to adheres to [Semantic Versioning](https://semver.org/).
Go to the `v1` branch to see the changelog of Lume 1.

## [Unreleased]
### Fixed
- Nav plugin: Breadcrumb with urls with CJK characters.

## [2.3.3] - 2024-10-07
### Added
- Basic auth middleware: Added `errorMessage` option.
Expand Down Expand Up @@ -546,6 +550,7 @@ Go to the `v1` branch to see the changelog of Lume 1.
[#668]: https://github.com/lumeland/lume/issues/668
[#671]: https://github.com/lumeland/lume/issues/671

[Unreleased]: https://github.com/lumeland/lume/compare/v2.3.3...HEAD
[2.3.3]: https://github.com/lumeland/lume/compare/v2.3.2...v2.3.3
[2.3.2]: https://github.com/lumeland/lume/compare/v2.3.1...v2.3.2
[2.3.1]: https://github.com/lumeland/lume/compare/v2.3.0...v2.3.1
Expand Down
5 changes: 4 additions & 1 deletion plugins/nav.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { merge } from "../core/utils/object.ts";
import { buildSort } from "../core/searcher.ts";
import { decodeURIComponentSafe } from "../core/utils/path.ts";

import type Site from "../core/site.ts";
import type Searcher from "../core/searcher.ts";
Expand Down Expand Up @@ -59,7 +60,9 @@ export class Nav {
this.#cache.set(id, nav);
}

const parts = url.split("/").filter((part) => part !== "");
const parts = url.split("/").filter((part) => part !== "").map(
decodeURIComponentSafe,
);
return searchData(parts, nav);
}

Expand Down
Loading

0 comments on commit 94b290b

Please sign in to comment.