Skip to content

Commit

Permalink
fix: conditional of data
Browse files Browse the repository at this point in the history
add `Pattern` result `boolean` type
- PR hexojs/hexo-util/pull/311
- changes hexojs/hexo-util@9ddb7e2
  • Loading branch information
dimaslanjaka committed May 17, 2023
1 parent 817c8ea commit 8d05b0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/plugins/filter/template_locals/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function i18nLocalsFilter(locals) {
const pattern = new Pattern(`${i18nDir}/*path`);
const data = pattern.match(locals.path);

if (data && data.lang && i18nLanguages.includes(data.lang)) {
if (!Array.isArray(data) && typeof data !== 'boolean' && data.lang && i18nLanguages.includes(data.lang)) {
lang = data.lang;
page.canonical_path = data.path;
} else {
Expand Down

0 comments on commit 8d05b0a

Please sign in to comment.