UNPKG

ngmeta

Version:

A tool for updating meta tags in an Angular application.

92 lines (91 loc) 3.37 kB
import { Title, Meta } from '@angular/platform-browser'; import { AllMeta, FacebookMeta, GoogleMeta, TagData, TagType, TwitterMeta } from './ngmeta.types'; import * as i0 from "@angular/core"; /** * Service that allows setting and updating of meta tags, title tags, and canonical tags. */ export declare class NgMeta { private _title; private _meta; private _dom; private _scroll; constructor(_title: Title, _meta: Meta, _dom: Document); /** * Returns native Angular service for managing HTML `<meta>` tags. * * @return Native Angular service for managing HTML `<meta>` tags. */ get meta(): Meta; /** * Scroll to top of page. * * @return Current instance of the NgMeta service. */ scrollToTop(): NgMeta; /** * Sets all meta details for page. * * @param param0 All meta details in head. * @return Current instance of the NgMeta service. */ setAll({ title, description, image, canonical, twitter, }: AllMeta): NgMeta; /** * Sets canonical URL of web page. * * @param canonical The canonical URL for your page. * @return Current instance of the NgMeta service. */ setCanonical(canonical?: string): NgMeta; /** * Sets description of web page. * * @param description Description relating to the content of page. * @return Current instance of the NgMeta service. */ setDescription(description?: string): NgMeta; /** * Sets Open Graph tags for optimal display on Facebook. * * @param param0 All Facebook Open Graph meta details in head. * @return Current instance of the NgMeta service. */ setFacebook({ locale, type, title, description, image, url, appId, }: FacebookMeta): NgMeta; /** * Sets microdata tags for optimal display on Google. * * @param param0 All Google microdata meta details in head. * @return Current instance of the NgMeta service. */ setGoogle({ title, description, image }: GoogleMeta): NgMeta; /** * Sets if after `setAll` window will scroll to top. * * @param scroll Boolean of wether to scroll to top or not. * @return Current instance of the NgMeta service. */ setScroll(scroll: boolean): NgMeta; /** * Sets a HTML element in the head with any attributes defined in object. * @param tagType Tag name of HTML Element. * @param tagData Details for tag to set in head. * @param overwrite Whether this method should overwrite an existing instance of the tag. Set to false by default. * @return Current instance of the NgMeta service. */ setTag(tagType: TagType, tagData: TagData, overwrite?: boolean): NgMeta; /** * Sets document's title shown in a browser's title bar or a page's tab. * * @param title Document's title. * @return Current instance of the NgMeta service. */ setTitle(title?: string): NgMeta; /** * Sets tags for optimal display as a Twitter card. * * @param param0 All Twitter microdata meta details in head. * @return Current instance of the NgMeta service. */ setTwitter({ title, description, image, alt, site }: TwitterMeta): NgMeta; static ɵfac: i0.ɵɵFactoryDeclaration<NgMeta, never>; static ɵprov: i0.ɵɵInjectableDeclaration<NgMeta>; }