Skip to content

Commit

Permalink
Use provider favicon for preprint discover page (#2032)
Browse files Browse the repository at this point in the history
  • Loading branch information
futa-ikeda authored Oct 17, 2023
1 parent 0b88341 commit a9b403d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/preprints/discover/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ import Route from '@ember/routing/route';
import RouterService from '@ember/routing/router-service';
import { inject as service } from '@ember/service';
import config from 'ember-osf-web/config/environment';
import PreprintProviderModel from 'ember-osf-web/models/preprint-provider';

import MetaTags, { HeadTagDef } from 'ember-osf-web/services/meta-tags';
import Theme from 'ember-osf-web/services/theme';

export default class PreprintDiscoverRoute extends Route {
@service store!: Store;
@service theme!: Theme;
@service router!: RouterService;
@service metaTags!: MetaTags;
headTags?: HeadTagDef[];

buildRouteInfoMetadata() {
return {
Expand All @@ -36,6 +40,20 @@ export default class PreprintDiscoverRoute extends Route {
}
}

// TODO: Move this to app/preprints/index/route.ts when landing page PR is merged
afterModel(model: PreprintProviderModel) {
if (model && model.assets && model.assets.favicon) {
const headTags = [{
type: 'link',
attrs: {
rel: 'icon',
href: model.assets.favicon,
},
}];
this.set('headTags', headTags);
}
}

deactivate() {
this.theme.reset();
}
Expand Down

0 comments on commit a9b403d

Please sign in to comment.