diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..f6efb75c --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 18.17.1 diff --git a/app/routes/application.js b/app/routes/application.js index db93918c..9421ffec 100644 --- a/app/routes/application.js +++ b/app/routes/application.js @@ -11,8 +11,9 @@ export default class ApplicationRoute extends Route { @service legacyModuleMappings; - title(tokens) { - let [version, entity] = tokens; + title() { + let entity = this.headData.modelName; + let version = this.headData.modelVersion; if (!entity) { entity = 'Ember'; } @@ -30,6 +31,22 @@ export default class ApplicationRoute extends Route { async afterModel() { set(this, 'headData.cdnDomain', ENV.API_HOST); await this.legacyModuleMappings.initMappings(); + + let entity = this.headData.modelName; + let version = this.headData.modelVersion; + if (!entity) { + entity = 'Ember'; + } + if (version) { + const compactVersion = getCompactVersion(version); + const title = `${[entity, compactVersion].join( + ' - ' + )} - Ember API Documentation`; + set(this, 'headData.title', title); + return title; + } + return ''; + return super.afterModel(...arguments); } } diff --git a/app/routes/project-version.js b/app/routes/project-version.js index aedac1f9..7934aef0 100644 --- a/app/routes/project-version.js +++ b/app/routes/project-version.js @@ -43,6 +43,10 @@ export default class ProjectVersionRoute extends Route { }); } + afterModel(model) { + this.headData.modelVersion = model.version; + } + // Using redirect instead of afterModel so transition succeeds and returns 307 redirect(model, transition) { const lookupParams = (routeName) => { diff --git a/app/routes/project-version/classes/class.js b/app/routes/project-version/classes/class.js index db930130..9a11331b 100644 --- a/app/routes/project-version/classes/class.js +++ b/app/routes/project-version/classes/class.js @@ -36,6 +36,10 @@ export default class ClassRoute extends Route.extend(ScrollTracker) { return this.find('class', `${project}-${projectVersion}-${klass}`); } + afterModel(model) { + this.headData.modelName = model.name; + } + find(typeName, param) { return this.store.find(typeName, param).catch((e1) => { if (typeName != 'namespace') { diff --git a/app/routes/project-version/functions/function.js b/app/routes/project-version/functions/function.js index f0dd7cac..1769d9d1 100644 --- a/app/routes/project-version/functions/function.js +++ b/app/routes/project-version/functions/function.js @@ -56,6 +56,8 @@ export default class FunctionRoute extends Route { if (description) { set(this, 'headData.description', createExcerpt(description)); } + + this.headData.functionName = model?.fn?.name; } getFunctionObjFromList(classObj, functionName) { diff --git a/app/services/head-data.js b/app/services/head-data.js index de8bf244..1c318314 100644 --- a/app/services/head-data.js +++ b/app/services/head-data.js @@ -9,4 +9,6 @@ export default class HeadDataService extends Service { @tracked canonicalUrl; @tracked description; @tracked cdnDomain; + @tracked modelName; + @tracked modelVersion; } diff --git a/app/templates/application.hbs b/app/templates/application.hbs index 1f355c5a..f19e7b12 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -3,10 +3,10 @@ -
+
{{outlet}}
-{{!-- required by ember-cli-meta-tags --}} - +{{! required by ember-cli-meta-tags }} + \ No newline at end of file diff --git a/app/templates/head.hbs b/app/templates/head.hbs index b67e03fa..36b808bc 100644 --- a/app/templates/head.hbs +++ b/app/templates/head.hbs @@ -1,12 +1,12 @@ {{this.model.title}} - - + + {{#if this.model.description}} - - + + {{/if}} {{#unless this.model.isRelease}} - + {{/unless}} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0b8649dd..0149163c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,9 +56,9 @@ "ember-cli-deploy-gzip": "^1.0.0", "ember-cli-deprecation-workflow": "^2.1.0", "ember-cli-fastboot": "^3.3.2", + "ember-cli-head": "^2.0.0", "ember-cli-htmlbars": "^6.1.1", "ember-cli-inject-live-reload": "^2.1.0", - "ember-cli-meta-tags": "^7.0.0", "ember-cli-sass": "^10.0.1", "ember-cli-terser": "^4.0.2", "ember-composable-helpers": "^3.1.1", @@ -17051,22 +17051,6 @@ "node": "^4.5 || 6.* || >= 7.*" } }, - "node_modules/ember-cli-meta-tags": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/ember-cli-meta-tags/-/ember-cli-meta-tags-7.0.0.tgz", - "integrity": "sha512-fvfNB3TNVwNQOHWJ0vd+I1kFiRHcamEDJ9iNTtU9oxX1JIusSrp7JPb/t3DojMQUfEze/eiWQ98VE/zsFar31g==", - "dev": true, - "dependencies": { - "@glimmer/component": "^1.1.2", - "ember-cli-babel": "^7.26.11", - "ember-cli-head": "^2.0.0", - "ember-cli-htmlbars": "^6.0.1", - "ember-element-helper": "^0.6.1" - }, - "engines": { - "node": "14.* || 16.* || >= 18" - } - }, "node_modules/ember-cli-normalize-entity-name": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/ember-cli-normalize-entity-name/-/ember-cli-normalize-entity-name-1.0.0.tgz", @@ -46463,7 +46447,7 @@ "integrity": "sha512-W4gjJx1j+KPNF8Bg/3ecaTHPMC7IJ2pFKmYEZanWtzFk9MpM9kn+f14iXypIj8htHMRmzVByhzFhVWwuDKSTYg==", "dev": true, "requires": { - "node-sass": "^4.1.1" + "node-sass": "^9.0.0" } }, "bower-config": { @@ -54224,19 +54208,6 @@ "integrity": "sha512-QkLGcYv1WRK35g4MWu/uIeJ5Suk2eJXKtZ+8s+qE7C9INmpCPyPxzaqZABquYzcWNzIdw6kYwz3NWAFdKYFxwg==", "dev": true }, - "ember-cli-meta-tags": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/ember-cli-meta-tags/-/ember-cli-meta-tags-7.0.0.tgz", - "integrity": "sha512-fvfNB3TNVwNQOHWJ0vd+I1kFiRHcamEDJ9iNTtU9oxX1JIusSrp7JPb/t3DojMQUfEze/eiWQ98VE/zsFar31g==", - "dev": true, - "requires": { - "@glimmer/component": "^1.1.2", - "ember-cli-babel": "^7.26.11", - "ember-cli-head": "^2.0.0", - "ember-cli-htmlbars": "^6.0.1", - "ember-element-helper": "^0.6.1" - } - }, "ember-cli-normalize-entity-name": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/ember-cli-normalize-entity-name/-/ember-cli-normalize-entity-name-1.0.0.tgz", diff --git a/package.json b/package.json index 91cb6083..6a559244 100644 --- a/package.json +++ b/package.json @@ -74,9 +74,9 @@ "ember-cli-deploy-gzip": "^1.0.0", "ember-cli-deprecation-workflow": "^2.1.0", "ember-cli-fastboot": "^3.3.2", + "ember-cli-head": "^2.0.0", "ember-cli-htmlbars": "^6.1.1", "ember-cli-inject-live-reload": "^2.1.0", - "ember-cli-meta-tags": "^7.0.0", "ember-cli-sass": "^10.0.1", "ember-cli-terser": "^4.0.2", "ember-composable-helpers": "^3.1.1",