Skip to content

Commit

Permalink
web: Fix incorrect term when using URL mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
laymonage committed Apr 17, 2022
1 parent 94fac6b commit 2f9ba14
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions web/src/giscus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,16 @@ export class GiscusWidget extends LitElement {
return element ? element.content : '';
}

private _getCleanedUrl() {
const url = new URL(location.href);
url.searchParams.delete('giscus');
return url;
}

private getTerm() {
switch (this.mapping) {
case 'url':
return origin;
return `${this._getCleanedUrl()}`;
case 'title':
return document.title;
case 'og:title':
Expand All @@ -266,8 +272,7 @@ export class GiscusWidget extends LitElement {
}

private getIframeSrc() {
const url = new URL(location.href);
url.searchParams.delete('giscus');
const url = this._getCleanedUrl();

const origin = `${url}${this.id ? '#' + this.id : ''}`;

Expand Down

1 comment on commit 2f9ba14

@vercel
Copy link

@vercel vercel bot commented on 2f9ba14 Apr 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

giscus-component – ./

giscus-component-git-main-giscus.vercel.app
giscus-component.vercel.app
giscus-component-giscus.vercel.app

Please sign in to comment.