Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import HeadData from 'ember-meta/services/head-data';
import config from 'ember-get-config';
import { computed } from '@ember/object';
import { getOwner } from '@ember/application';
import { inject as service } from '@ember/service';
import { isPresent } from '@ember/utils';
export default HeadData.extend({
page: service(),
guidemaker: service(),
currentRouteModel: computed('routeName', function() {
return getOwner(this).lookup(`route:${this.routeName}`).get('currentModel.content');
}),
title: computed('routeName', 'page.{currentPage,currentSection}', function() {
if(!this.page.currentPage || !this.page.currentSection) {
return this.guidemaker.title;
}
let title = `${this.page.currentPage.title} - ${this.page.currentSection.title}`;
if(this.guidemaker.title) {
title += ` - ${this.guidemaker.title}`
}
import HeadData from 'ember-meta/services/head-data';
import { computed, get } from '@ember/object';
import { getOwner } from '@ember/application';
import config from 'ember-get-config';
import { getExcerpt } from '../helpers/excerpt';
const { blog } = config;
export default HeadData.extend({
author: computed('routeName', function() {
return this.get('currentRouteModel.author.name');
}),
currentRouteModel: computed('routeName', function() {
return getOwner(this).lookup(`route:${this.get('routeName')}`).get('currentModel.post') || {};
}),
description: computed('routeName', function() {
let currentModel = this.get('currentRouteModel');
if(currentModel && get(currentModel, 'html')) {
const excerpt = getExcerpt(get(currentModel, 'html'), {
words: 33
})
return `${excerpt}...`;