UNPKG

@ima/core

Version:

IMA.js framework for isomorphic javascript application

158 lines (157 loc) 5.11 kB
/** * The Meta manager is a utility for managing various page attributes related * to the SEO (search engine optimization) and social network integration. * * The Meta manager is used to manage the following: * - page title, set using the contents of the `<title>` element * - page links, linking related documents and meta-information, added to the * using `<link>` elements * - page meta information: * - the generic named meta information added to the page via * `<meta>} elements with the `name` attribute, for * example the `keywords`. * - specialized meta information added to the page via `<meta>` * elements with the `property` attribute, for example the OG meta * tags (`og:type`, `og:image`, etc.). */ export class MetaManager { /** * Sets the page title. * * @param title The new page title. */ setTitle(title) { return this; } /** * Returns the page title. The method returns an empty string if no page * title has been set yet. * * Note that the page title is cached internally by the meta manager and * may therefore differ from the current document title if it has been * modified by a 3rd party code. * * @return The current page title. */ getTitle() { return ''; } /** * Set the specified named meta information property. * * @param name Meta information property name, for example * `keywords`. * @param content The meta information content. * @parram attr Additional optional meta attributes. */ setMetaName(name, content, attr) { return this; } /** * Returns the value of the specified named meta information property. The * method returns an empty string for missing meta information (to make the * returned value React-friendly). * * @param name The name of the named meta information property. * @return The value of the generic meta information, or an empty string. */ getMetaName(name) { return { content: '' }; } /** * Returns the names of the currently specified named meta information * properties. * * @return The names of the currently specified named meta * information properties. */ getMetaNames() { return []; } /** * Return [key, value] pairs of named meta information. * * @return [key, value] pairs of named meta information. */ getMetaNamesIterator() { return []; } /** * Sets the specified specialized meta information property. * * @param name Name of the specialized meta information property. * @param property The value of the meta information property. * @parram attr Additional optional meta attributes. */ setMetaProperty(property, content, attr) { return this; } /** * Returns the value of the specified specialized meta information * property. The method returns an empty string for missing meta * information (to make the returned value React-friendly). * * @param name The name of the specialized meta information * property. * @return The value of the specified meta information, or an * empty string. */ getMetaProperty(property) { return { content: '' }; } /** * Returns the names of the currently specified specialized meta * information properties. * * @return The names of the currently specified specialized meta * information properties. */ getMetaProperties() { return []; } /** * Return [key, value] pairs of meta information properties. * * @return [key, value] pairs of meta information properties. */ getMetaPropertiesIterator() { return []; } /** * Sets the specified specialized link information. * * @param relation The relation of the link target to the current * page. * @param href The reference to the location of the related * document, e.g. a URL. * @parram attr Additional optional link attributes. */ setLink(relation, href, attr) { return this; } /** * Return the reference to the specified related linked document. The * method returns an empty string for missing meta information (to make the * returned value React-friendly). * * @param relation The relation of the link target to the current * page. * @return The reference to the location of the related document, * e.g. a URL. */ getLink(relation) { return { href: '' }; } /** * Returns the relations of the currently set related documents linked to * the current page. */ getLinks() { return []; } /** * Return [key, value] pairs of currently set links. * * @return [key, value] pairs of currently set links. */ getLinksIterator() { return []; } /** * Resets the stored meta names, properties and links. */ clearMetaAttributes() { return; } } //# sourceMappingURL=MetaManager.js.map