fix canonical URL edge case

This commit is contained in:
jake committed 2021-10-03 12:28:27 -04:00
1 parent 013550c1f9
commit bb8e5e2248
5 files changed
+46 -25

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ if (wrapper && canonical) {
wrapper.style.display = "inline-flex";
// get path and strip beginning and ending forward slash
const slug = urlParse(canonical.href).pathname.replace(/^\/|\/$/g, "");
const slug = urlParse(canonical).pathname.replace(/^\/|\/$/g, "");
fetch(`/api/hits/?slug=${encodeURIComponent(slug)}`)
.then((response) => response.json())