ChromeDevTools / debugger-protocol-viewer

DevTools Protocol API docs—its domains, methods, and events
https://chromedevtools.github.io/devtools-protocol/
Other
862 stars 173 forks source link

Tweak page title to be more useful #148

Closed paulirish closed 4 years ago

paulirish commented 4 years ago

right now the <title> doesn't mention what domain you're looking at. (but the two descriptions do!)

image

I wanted to do two things

  1. show the domain in the title
  2. don't include - version tot because essentially this is the default. (but show the version if its not tot)

i tried this:

  {{#if domain}}
    <title>Chrome DevTools Protocol {{#if isTot}} {{else}} - version {{{version}}} {{/if}} - {{{domain.domain}}}</title>
  {{else}}
    <title>Chrome DevTools Protocol {{#if isTot}} {{else}} - version {{{version}}} {{/if}}</title>
  {{/if}}

along with this:

```patch diff --git a/pages/domainGenerator.js b/pages/domainGenerator.js index cb33da0..210dfe3 100644 --- a/pages/domainGenerator.js +++ b/pages/domainGenerator.js @@ -18,6 +18,7 @@ const itemSort = (a, b) => { export class DomainGenerator { constructor(version) { this.version = version; + this.isTot = version === 'tot'; } data() { @@ -26,6 +27,7 @@ export class DomainGenerator { layout: 'shell.hbs', title: `Chrome DevTools Protocol - ${version}`, version, + isTot: this.isTot, shadow: 'domain', pagination: { data: `${version}.domains`, ```

However this doesn't always work. (like on http://localhost:8000/devtools-protocol/tot/ ... isTot was undefined)

TBH i can't really follow the data cascade especially with the cool domaingenerator indirection, so I was hoping you could point me in the right direction @TimvdLippe ;)