|
1 | 1 | import pageTitle from 'ember-page-title/helpers/page-title'; |
2 | | -import HeadLayout from 'ember-cli-head/components/head-layout'; |
| 2 | +import InHead from 'ember-api-docs/components/in-head'; |
3 | 3 | import EsHeader from 'ember-styleguide/components/es-header'; |
4 | 4 | import ApiSearch from 'ember-api-docs/components/api-search'; |
5 | 5 | import EsFooter from 'ember-styleguide/components/es-footer'; |
| 6 | +import Component from '@glimmer/component'; |
| 7 | +import { service } from '@ember/service'; |
6 | 8 | import BasicDropdownWormhole from 'ember-basic-dropdown/components/basic-dropdown-wormhole'; |
7 | | -<template> |
8 | | - {{pageTitle "Ember API Documentation"}} |
| 9 | +import config from 'ember-api-docs/config/environment'; |
9 | 10 |
|
10 | | - <HeadLayout /> |
| 11 | +export default class Application extends Component { |
| 12 | + @service headData; |
| 13 | + @service router; |
11 | 14 |
|
12 | | - <EsHeader> |
13 | | - <ApiSearch /> |
14 | | - </EsHeader> |
| 15 | + get canonicalUrl() { |
| 16 | + let path = this.router.currentURL; |
| 17 | + let version = new RegExp(this.headData.compactVersion, 'g'); |
| 18 | + return `${config.APP.domain}/${path.replace(version, 'release')}`; |
| 19 | + } |
15 | 20 |
|
16 | | - <main> |
17 | | - {{outlet}} |
18 | | - </main> |
| 21 | + <template> |
| 22 | + {{pageTitle "Ember API Documentation"}} |
19 | 23 |
|
20 | | - <EsFooter /> |
21 | | - <BasicDropdownWormhole /> |
22 | | -</template> |
| 24 | + <InHead> |
| 25 | + <link rel="dns-prefetch" href="{{this.headData.cdnDomain}}" /> |
| 26 | + |
| 27 | + {{#if this.headData.description}} |
| 28 | + <meta name="description" content={{this.headData.description}} /> |
| 29 | + <meta property="og:description" content={{this.headData.description}} /> |
| 30 | + {{/if}} |
| 31 | + |
| 32 | + {{#unless this.headData.isRelease}} |
| 33 | + <link rel="canonical" href={{this.canonicalUrl}} /> |
| 34 | + {{/unless}} |
| 35 | + </InHead> |
| 36 | + |
| 37 | + <EsHeader> |
| 38 | + <ApiSearch /> |
| 39 | + </EsHeader> |
| 40 | + |
| 41 | + <main> |
| 42 | + {{outlet}} |
| 43 | + </main> |
| 44 | + |
| 45 | + <EsFooter /> |
| 46 | + <BasicDropdownWormhole /> |
| 47 | + </template> |
| 48 | +} |
0 commit comments