How to use ember-meta - 2 common examples

To help you get started, we’ve selected a few ember-meta examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github empress / guidemaker / addon / services / head-data.js View on Github external
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}`
    }
github empress / empress-blog / app / services / head-data.js View on Github external
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}...`;

ember-meta

Setup meta for your Prember/Ember blog to support opengraph, microdata, Facebook, Twitter, Slack etc.

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular ember-meta functions