1 | /**
|
2 | @license
|
3 | Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7 | Code distributed by Google as part of the polymer project is also
|
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9 | */
|
10 | /**
|
11 | Utility method that updates the page's open graph and Twitter card metadata.
|
12 | It takes an object as a parameter with the following properties:
|
13 | title | description | url | image.
|
14 |
|
15 | If the `url` is not specified, `window.location.href` will be used; for
|
16 | all other properties, if they aren't specified, then that metadata field will not
|
17 | be set.
|
18 |
|
19 | Example (in your top level element or document, or in the router callback):
|
20 |
|
21 | import { updateMetadata } from 'pwa-helpers/metadata.js';
|
22 |
|
23 | updateMetadata({
|
24 | title: 'My App - view 1',
|
25 | description: 'This is my sample app',
|
26 | url: window.location.href,
|
27 | image: '/assets/view1-hero.png'
|
28 | });
|
29 |
|
30 | */
|
31 | export declare const updateMetadata: ({ title, description, url, image, imageAlt }: {
|
32 | title?: string | undefined;
|
33 | description?: string | undefined;
|
34 | url?: string | undefined;
|
35 | image?: string | undefined;
|
36 | imageAlt?: string | undefined;
|
37 | }) => void;
|
38 | /**
|
39 | Utility method to create or update the content of a meta tag based on an
|
40 | attribute name/value pair.
|
41 |
|
42 | Example (in your top level element or document, or in the router callback):
|
43 |
|
44 | import { setMetaTag } from 'pwa-helpers/metadata.js';
|
45 |
|
46 | setMetaTag('name', 'twitter:card', 'summary');
|
47 |
|
48 | This would create the following meta tag in the head of the document (or
|
49 | update the content attribute if a meta tag with name="twitter:card" exists):
|
50 |
|
51 | <meta name="twitter:card" content="summary">
|
52 |
|
53 | */
|
54 | export declare function setMetaTag(attrName: string, attrValue: string, content: string): void;
|