mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-27 04:03:48 +01:00
An extremely simple fix to decode special characters
This commit is contained in:
parent
839fbd0ecb
commit
9bce57279a
1 changed files with 2 additions and 2 deletions
|
@ -36,7 +36,7 @@
|
|||
const wrongUrl = new URL(window.location.href);
|
||||
|
||||
/// Get the search keyword from the wrong URL by removing all slashes and dashes
|
||||
const searchKeyword = wrongUrl.pathname.split(/[/|-]/).join(' ').trim();
|
||||
const searchKeyword = decodeURIComponent(wrongUrl.pathname).split(/[/|-]/).join(' ').trim();
|
||||
|
||||
document.getElementById('searchInput').setAttribute('value', searchKeyword);
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue