import { Injectable } from '@angular/core' ; import { MindsUser } from '../../../interfaces/entities' ; import { MetaService , MIN_METRIC_FOR_ROBOTS , } from '../../../common/services/meta.service' ; /**
 * SEO meta headers service
 */ @ Injectable ( ) export class SeoService { param meta constructor ( protected meta ) { } param user set ( user ) { if ( typeof user === 'string' ) { this . meta . setTitle ( user ) ; return ; } if ( user . not_found || ! user . avatar_url ) { return ; } const url = `/${ user . username . toLowerCase ( ) }/` ; this . meta . setTitle ( `${ user . name } (@${ user . username })` ) . setDescription ( user . briefdescription || `Subscribe to @${ user . username }` ) . setOgUrl ( url ) . setCanonicalUrl ( url ) . setOgImage ( user . avatar_url . master , { width : 2000 , height : 1000 , } ) . setOgType ( 'profile' ) . setRobots ( user [ 'subscribers_count' ] < MIN_METRIC_FOR_ROBOTS ? 'noindex' : 'all' ) ; if ( user . is_mature || user . nsfw . length ) { this . meta . setNsfw ( true ) ; } } }