fix: encode tag for URI (WEB-1)

The tag 'c#' was causing problems since # is a special URI char oops.
This commit is contained in:
Oliver Booth 2023-09-24 17:15:40 +01:00
parent f48713c470
commit a0fd48e6ca
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
2 changed files with 3 additions and 1 deletions

View File

@ -41,7 +41,7 @@
</div>
<div class="card-footer">
{{#each post.tags}}
<a href="?tag={{this}}" class="badge text-bg-dark">{{this}}</a>
<a href="?tag={{urlEncode this}}" class="badge text-bg-dark">{{this}}</a>
{{/each}}
</div>
</script>

View File

@ -28,6 +28,8 @@ declare const Prism: any;
}
});
Handlebars.registerHelper("urlEncode", encodeURIComponent);
function getQueryVariable(variable: string): string {
const query = window.location.search.substring(1);
const vars = query.split("&");