diff --git a/README.md b/README.md index 971d6991..6e59663d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A lightweight comments widget built on GitHub issues. Use GitHub issues for blog ## how it works -When Utterances loads, the GitHub [issue search API](https://developer.github.com/v3/search/#search-issues) is used to find the issue associated with the page based on `url`, `pathname` or `title`. If we cannot find an issue that matches the page, no problem, [utterances-bot](https://github.com/utterances-bot) will automatically create an issue the first time someone comments. +When Utterances loads, the GitHub [issue search API](https://developer.github.com/v3/search/#search-issues) is used to find the issue associated with the page based on `url`, `pathname`, `pathnameVersion` or `title`. If we cannot find an issue that matches the page, no problem, [utterances-bot](https://github.com/utterances-bot) will automatically create an issue the first time someone comments. To comment, users must authorize the utterances app to post on their behalf using the GitHub [OAuth flow](https://developer.github.com/v3/oauth/#web-application-flow). Alternatively, users can comment on the GitHub issue directly. diff --git a/src/client.ts b/src/client.ts index 848369cd..4b47f5ce 100644 --- a/src/client.ts +++ b/src/client.ts @@ -37,6 +37,10 @@ const canonicalLink = document.querySelector(`link[rel='canonical']`) as HTMLLin attrs.url = canonicalLink ? canonicalLink.href : location.origin + location.pathname + location.search; attrs.origin = location.origin; attrs.pathname = location.pathname.length < 2 ? 'index' : location.pathname.substr(1).replace(/\.\w+$/, ''); +// Remove version segment to create pathnameVersion ( ex: v4.24/my/doc/page -> my/doc/page) +attrs.pathnameVersion = (attrs.pathname.split("/").length > 1) ? + attrs.pathname.split("/").slice(1).join("/") : + attrs.pathname; attrs.title = document.title; const descriptionMeta = document.querySelector(`meta[name='description']`) as HTMLMetaElement; attrs.description = descriptionMeta ? descriptionMeta.content : ''; diff --git a/src/configuration-component.ts b/src/configuration-component.ts index f07de40c..21d57ee7 100644 --- a/src/configuration-component.ts +++ b/src/configuration-component.ts @@ -47,6 +47,17 @@ export class ConfigurationComponent {

+
+ +