svelte-meta-tags 1.2.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ # [2.1.0](https://github.com/oekazuma/svelte-meta-tags/compare/v2.0.0...v2.1.0) (2021-11-04)
2
+
3
+ ### Features
4
+
5
+ - allow title to be dynamically changed ([b9acefb](https://github.com/oekazuma/svelte-meta-tags/commit/b9acefbea7c64b5434837ffecc17423dcf0ce2d3))
6
+
7
+ # [2.0.0](https://github.com/oekazuma/svelte-meta-tags/compare/v1.2.2...v2.0.0) (2021-09-18)
8
+
9
+ ### chore
10
+
11
+ - change name the MetaTags export ([d40b535](https://github.com/oekazuma/svelte-meta-tags/commit/d40b535249be8b629ba1034358865aa08993927c))
12
+ - remove jsonLd property from MetaTags component ([a05ae2b](https://github.com/oekazuma/svelte-meta-tags/commit/a05ae2b72a8605253a50249e8f76ee76cbe1411d))
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ - Change the way import is written.
17
+ - Remove jsonLd parameter from MetaTags component.
18
+ Please use the JsonLd component from now on.
19
+
20
+ ## [1.2.2](https://github.com/oekazuma/svelte-meta-tags/compare/v1.2.1...v1.2.2) (2021-09-07)
21
+
22
+ ### Bug Fixes
23
+
24
+ - fix types in package.json ([7be485a](https://github.com/oekazuma/svelte-meta-tags/commit/7be485a880203ce2038ea91768031fbbf66d32b5))
25
+
26
+ ## [1.2.1](https://github.com/oekazuma/svelte-meta-tags/compare/v1.2.0...v1.2.1) (2021-09-07)
27
+
28
+ ### Bug Fixes
29
+
30
+ - restore the emitTypes setting of package ([20d8a85](https://github.com/oekazuma/svelte-meta-tags/commit/20d8a85ab0f76a1a7c270cdf3a1062eb83c1aa59))
31
+
1
32
  # [1.2.0](https://github.com/oekazuma/svelte-meta-tags/compare/v1.1.1...v1.2.0) (2021-09-07)
2
33
 
3
34
  ### Features
package/MetaTags.svelte CHANGED
@@ -1,5 +1,5 @@
1
1
  <script>
2
- export let title = undefined;
2
+ export let title = '';
3
3
  export let noindex = false;
4
4
  export let nofollow = false;
5
5
  export let robotsProps = undefined;
@@ -12,7 +12,6 @@
12
12
  export let canonical = undefined;
13
13
  export let additionalMetaTags = undefined;
14
14
  export let additionalLinkTags = undefined;
15
- export let jsonLd = undefined;
16
15
 
17
16
  let robotsParams = '';
18
17
  if (robotsProps) {
@@ -37,18 +36,10 @@
37
36
  notranslate ? ',notranslate' : ''
38
37
  }`;
39
38
  }
40
-
41
- if (typeof jsonLd !== 'undefined') {
42
- console.warn(
43
- '[WARNING]: JSON-LD will soon be completely separated from the <MetaTags/> component and will no longer work. Please import and use `JsonLd`.'
44
- );
45
- }
46
39
  </script>
47
40
 
48
41
  <svelte:head>
49
- {#if title}
50
- <title>{title}</title>
51
- {/if}
42
+ <title>{title}</title>
52
43
 
53
44
  <meta
54
45
  name="robots"
@@ -272,10 +263,4 @@
272
263
  <link {...tag} />
273
264
  {/each}
274
265
  {/if}
275
-
276
- {#if jsonLd}
277
- {@html `<script type="application/ld+json">${
278
- JSON.stringify({ '@context': 'https://schema.org', ...jsonLd }) + '<'
279
- }/script>`}
280
- {/if}
281
266
  </svelte:head>
package/README.md CHANGED
@@ -11,6 +11,36 @@ Svelte Meta Tags is a plugin that makes managing your SEO easier in Svelte proje
11
11
 
12
12
  This library is inspired by [next-seo](https://github.com/garmeeh/next-seo)
13
13
 
14
+ **Table of Contents**
15
+
16
+ - [Installing](#-installing)
17
+ - [Usage](#-usage)
18
+ - [Properties](#properties)
19
+ - [Twitter](#twitter)
20
+ - [Facebook](#facebook)
21
+ - [robotsProps](#robotsprops)
22
+ - [Alternate](#alternate)
23
+ - [Additional Meta Tags](#additional-meta-tags)
24
+ - [Additional Link Tags](#additional-link-tags)
25
+ - [Open Graph](#open-graph)
26
+ - [Open Graph Examples](#open-graph-examples)
27
+ - [Basic](#basic)
28
+ - [Video](#video)
29
+ - [Article](#article)
30
+ - [Book](#book)
31
+ - [Profile](#profile)
32
+ - [JSON-LD](#json-ld)
33
+ - [Using schema-dts](#using-schema-dts)
34
+ - [JSON-LD Examples](#json-ld-examples)
35
+ - [Article](#article)
36
+ - [Breadcrumb](#breadcrumb)
37
+ - [Product](#product)
38
+ - [Course](#course)
39
+ - [DataSet](#dataset)
40
+ - [FAQ](#faq)
41
+ - [Types Import](#types-import)
42
+ - [Types Import Examples](#types-import-examples)
43
+
14
44
  ### 📦 Installing
15
45
 
16
46
  ```shell
@@ -29,7 +59,7 @@ yarn add svelte-meta-tags
29
59
 
30
60
  ```svelte
31
61
  <script>
32
- import MetaTags from 'svelte-meta-tags';
62
+ import { MetaTags } from 'svelte-meta-tags';
33
63
  </script>
34
64
 
35
65
  <MetaTags title="Example Title" description="Example Description." />
@@ -39,7 +69,7 @@ yarn add svelte-meta-tags
39
69
 
40
70
  ```svelte
41
71
  <script>
42
- import MetaTags from 'svelte-meta-tags';
72
+ import { MetaTags } from 'svelte-meta-tags';
43
73
  </script>
44
74
 
45
75
  <MetaTags
@@ -120,7 +150,20 @@ yarn add svelte-meta-tags
120
150
  | `openGraph.article.authors` | string[] | Writers of the article. |
121
151
  | `openGraph.article.section` | string | A high-level section name. E.g. Technology |
122
152
  | `openGraph.article.tags` | string[] | Tag words associated with this article. |
123
- | `jsonLd` | object | Data in `ld+json` format. **NOTE: It will stop working in v2.0.0!** [Details](#json-ld-warning) |
153
+
154
+ #### Twitter
155
+
156
+ Twitter will read the `og:title`, `og:image` and `og:description` tags for their card, this is why `svelte-meta-tags` omits `twitter:title`, `twitter:image` and `twitter:description` so not to duplicate.
157
+
158
+ #### Facebook
159
+
160
+ ```js
161
+ facebook={{
162
+ appId: '1234567890',
163
+ }}
164
+ ```
165
+
166
+ Add this to your SEO config to include the fb:app_id meta if you need to enable Facebook insights for your site. Information regarding this can be found in facebook's [documentation](https://developers.facebook.com/docs/sharing/webmasters/)
124
167
 
125
168
  #### robotsProps
126
169
 
@@ -130,34 +173,35 @@ Example:
130
173
 
131
174
  ```svelte
132
175
  <script>
133
- import MetaTags from 'svelte-meta-tags';
176
+ import { MetaTags } from 'svelte-meta-tags';
134
177
  </script>
135
178
 
136
179
  <MetaTags
137
180
  robotsProps={{
138
- nosnippet: true,
139
- notranslate: true,
140
- noimageindex: true,
141
181
  noarchive: true,
182
+ nosnippet: true,
142
183
  maxSnippet: -1,
143
184
  maxImagePreview: 'none',
144
- maxVideoPreview: -1
185
+ maxVideoPreview: -1,
186
+ notranslate: true,
187
+ noimageindex: true,
188
+ unavailableAfter: '25 Jun 2010 15:00:00 PST'
145
189
  }}
146
190
  />
147
191
  ```
148
192
 
149
193
  **Available properties**
150
194
 
151
- | Property | Type | Description |
152
- | ------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
153
- | `noarchive` | boolean | Do not show a [cached link](https://support.google.com/websearch/answer/1687222) in search results. |
154
- | `nosnippet` | boolean | Do not show a text snippet or video preview in the search results for this page. |
155
- | `max-snippet` | number | Use a maximum of [number] characters as a textual snippet for this search result. [Read more](https://developers.google.com/search/reference/robots_meta_tag?hl=en-GB#directives) |
156
- | `max-image-preview` | 'none','standard','large' | Set the maximum size of an image preview for this page in a search results. |
157
- | `max-video-preview` | number | Use a maximum of [number] seconds as a video snippet for videos on this page in search results. [Read more](https://developers.google.com/search/reference/robots_meta_tag?hl=en-GB#directives) |
158
- | `notranslate` | boolean | Do not offer translation of this page in search results. |
159
- | `noimageindex` | boolean | Do not index images on this page. |
160
- | `unavailable_after` | string | Do not show this page in search results after the specified date/time. The date/time must be specified in a widely adopted format including, but not limited to RFC 822, RFC 850, and ISO 8601. |
195
+ | Property | Type | Description |
196
+ | ------------------ | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
197
+ | `noarchive` | boolean | Do not show a [cached link](https://support.google.com/websearch/answer/1687222) in search results. |
198
+ | `nosnippet` | boolean | Do not show a text snippet or video preview in the search results for this page. |
199
+ | `maxSnippet` | number | Use a maximum of [number] characters as a textual snippet for this search result. [Read more](https://developers.google.com/search/reference/robots_meta_tag?hl=en-GB#directives) |
200
+ | `maxImagePreview` | 'none','standard','large' | Set the maximum size of an image preview for this page in a search results. |
201
+ | `maxVideoPreview` | number | Use a maximum of [number] seconds as a video snippet for videos on this page in search results. [Read more](https://developers.google.com/search/reference/robots_meta_tag?hl=en-GB#directives) |
202
+ | `notranslate` | boolean | Do not offer translation of this page in search results. |
203
+ | `noimageindex` | boolean | Do not index images on this page. |
204
+ | `unavailableAfter` | string | Do not show this page in search results after the specified date/time. The date/time must be specified in a widely adopted format including, but not limited to RFC 822, RFC 850, and ISO 8601. |
161
205
 
162
206
  For more reference about the `X-Robots-Tag` visit [Google Search Central - Control Crawling and Indexing](https://developers.google.com/search/reference/robots_meta_tag?hl=en-GB#directives)
163
207
 
@@ -293,19 +337,19 @@ For the full specification please check out <http://ogp.me/>
293
337
 
294
338
  Svelte Meta Tags currently supports:
295
339
 
296
- - [basic](#basic)
297
- - [video](#video)
298
- - [article](#article)
299
- - [book](#book)
300
- - [profile](#profile)
340
+ - [Basic](#basic)
341
+ - [Video](#video)
342
+ - [Article](#article)
343
+ - [Book](#book)
344
+ - [Profile](#profile)
301
345
 
302
346
  ### Open Graph Examples
303
347
 
304
- #### basic
348
+ #### Basic
305
349
 
306
350
  ```svelte
307
351
  <script>
308
- import MetaTags from 'svelte-meta-tags';
352
+ import { MetaTags } from 'svelte-meta-tags';
309
353
  </script>
310
354
 
311
355
  <MetaTags
@@ -338,7 +382,7 @@ Full info on [http://ogp.me/](http://ogp.me/#type_video)
338
382
 
339
383
  ```svelte
340
384
  <script>
341
- import MetaTags from 'svelte-meta-tags';
385
+ import { MetaTags } from 'svelte-meta-tags';
342
386
  </script>
343
387
 
344
388
  <MetaTags
@@ -381,7 +425,7 @@ Full info on [http://ogp.me/](http://ogp.me/#type_video)
381
425
 
382
426
  ```svelte
383
427
  <script>
384
- import MetaTags from 'svelte-meta-tags';
428
+ import { MetaTags } from 'svelte-meta-tags';
385
429
  </script>
386
430
 
387
431
  <MetaTags
@@ -417,7 +461,7 @@ Full info on [http://ogp.me/](http://ogp.me/#type_video)
417
461
 
418
462
  ```svelte
419
463
  <script>
420
- import MetaTags from 'svelte-meta-tags';
464
+ import { MetaTags } from 'svelte-meta-tags';
421
465
  </script>
422
466
 
423
467
  <MetaTags
@@ -451,7 +495,7 @@ Full info on [http://ogp.me/](http://ogp.me/#type_video)
451
495
 
452
496
  ```svelte
453
497
  <script>
454
- import MetaTags from 'svelte-meta-tags';
498
+ import { MetaTags } from 'svelte-meta-tags';
455
499
  </script>
456
500
 
457
501
  <MetaTags
@@ -482,15 +526,13 @@ Full info on [http://ogp.me/](http://ogp.me/#type_video)
482
526
 
483
527
  JSON-LD allow for more customized and rich representation for example in search results.
484
528
 
485
- It can also be used when multiple JSON-LDs are needed.
486
-
487
529
  To discover all the different content types JSON-LD offers check out: https://developers.google.com/search/docs/guides/search-gallery
488
530
 
489
- **NOTE: This plugin uses [schema-dts](https://github.com/google/schema-dts), so it supports more than just usage examples.**
531
+ It is also possible to use multiple `<JsonLd />` components in a single page.
490
532
 
491
- ### JSON-LD Warning
533
+ ### Using `schema-dts`
492
534
 
493
- In v2.0.0, JSON-LD will be completely separated from the `<MetaTags/>` component. Please use the `<JsonLd/>` component from now on!
535
+ This plugin uses [schema-dts](https://github.com/google/schema-dts), so it also provides types other than the usage examples below.
494
536
 
495
537
  ### JSON-LD Examples
496
538
 
@@ -691,14 +733,13 @@ In v2.0.0, JSON-LD will be completely separated from the `<MetaTags/>` component
691
733
 
692
734
  ## Types Import
693
735
 
694
- You can import and use types such as `MetaTagsProps` and `JsonLdProps`.
736
+ You can import and use the types `MetaTagsProps` and `JsonLdProps`.
695
737
 
696
738
  ### Types Import Examples
697
739
 
698
740
  ```svelte
699
741
  <script lang="ts">
700
- import MetaTags, { JsonLd } from 'svelte-meta-tags';
701
- import type { MetaTagsProps, JsonLdProps } from 'svelte-meta-tags';
742
+ import { MetaTags, JsonLd, MetaTagsProps, JsonLdProps } from 'svelte-meta-tags';
702
743
 
703
744
  const metatags: MetaTagsProps = {
704
745
  title: 'Types Page Title | Svelte Meta Tags',
package/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { default } from './MetaTags.svelte';
1
+ export { default as MetaTags } from './MetaTags.svelte';
2
2
  export { default as JsonLd } from './JsonLd.svelte';
3
3
  export type { MetaTagsProps, JsonLdProps } from './types';
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { default } from './MetaTags.svelte';
1
+ export { default as MetaTags } from './MetaTags.svelte';
2
2
  export { default as JsonLd } from './JsonLd.svelte';
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "svelte-meta-tags",
3
- "version": "1.2.1",
3
+ "version": "2.2.0",
4
4
  "description": "Svelte Meta Tags is a plugin that makes managing your SEO easier in Svelte projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "svelte": "index.js",
8
8
  "main": "index.js",
9
9
  "module": "index.js",
10
- "types": "type.d.ts",
10
+ "types": "index.d.ts",
11
11
  "keywords": [
12
12
  "svelte",
13
13
  "svelteKit",
@@ -25,29 +25,29 @@
25
25
  "schema-dts": "1.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@commitlint/cli": "13.1.0",
29
- "@commitlint/config-conventional": "13.1.0",
30
- "@semantic-release/changelog": "5.0.1",
31
- "@semantic-release/git": "9.0.1",
32
- "@sveltejs/kit": "1.0.0-next.164",
33
- "@typescript-eslint/eslint-plugin": "4.31.0",
34
- "@typescript-eslint/parser": "4.31.0",
35
- "cypress": "8.3.1",
36
- "eslint": "7.32.0",
28
+ "@commitlint/cli": "15.0.0",
29
+ "@commitlint/config-conventional": "15.0.0",
30
+ "@semantic-release/changelog": "6.0.1",
31
+ "@semantic-release/git": "10.0.1",
32
+ "@sveltejs/kit": "1.0.0-next.202",
33
+ "@typescript-eslint/eslint-plugin": "5.7.0",
34
+ "@typescript-eslint/parser": "5.7.0",
35
+ "cypress": "9.1.1",
36
+ "eslint": "8.4.1",
37
37
  "eslint-config-prettier": "8.3.0",
38
- "eslint-plugin-cypress": "2.11.3",
39
- "eslint-plugin-svelte3": "3.2.0",
40
- "husky": "7.0.2",
41
- "lint-staged": "11.1.2",
42
- "prettier": "2.3.2",
43
- "prettier-plugin-svelte": "2.4.0",
44
- "semantic-release": "17.4.7",
45
- "svelte": "3.42.4",
46
- "svelte-check": "2.2.5",
47
- "svelte-preprocess": "4.9.1",
48
- "svelte2tsx": "0.4.5",
38
+ "eslint-plugin-cypress": "2.12.1",
39
+ "eslint-plugin-svelte3": "3.2.1",
40
+ "husky": "7.0.4",
41
+ "lint-staged": "12.1.2",
42
+ "prettier": "2.5.1",
43
+ "prettier-plugin-svelte": "2.5.1",
44
+ "semantic-release": "18.0.1",
45
+ "svelte": "3.44.3",
46
+ "svelte-check": "2.2.10",
47
+ "svelte-preprocess": "4.10.0",
48
+ "svelte2tsx": "0.4.11",
49
49
  "tslib": "2.3.1",
50
- "typescript": "4.4.2"
50
+ "typescript": "4.5.4"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "svelte": "^3.39.0"
package/types.d.ts CHANGED
@@ -21,7 +21,7 @@ export interface AdditionalRobotsProps {
21
21
  notranslate?: boolean;
22
22
  }
23
23
  export interface Twitter {
24
- cardType?: string;
24
+ cardType?: 'summary' | 'summary_large_image' | 'app' | 'player';
25
25
  site?: string;
26
26
  handle?: string;
27
27
  }
@@ -97,7 +97,6 @@ interface OpenGraphVideoActors {
97
97
 
98
98
  interface BaseMetaTag {
99
99
  content: string;
100
- keyOverride?: string;
101
100
  }
102
101
 
103
102
  interface HTML5MetaTag extends BaseMetaTag {
@@ -131,7 +130,6 @@ export interface LinkTag {
131
130
  sizes?: string;
132
131
  type?: string;
133
132
  color?: string;
134
- keyOverride?: string;
135
133
  }
136
134
 
137
135
  export interface MetaTagsProps {
@@ -148,7 +146,6 @@ export interface MetaTagsProps {
148
146
  openGraph?: OpenGraph;
149
147
  additionalMetaTags?: ReadonlyArray<MetaTag>;
150
148
  additionalLinkTags?: ReadonlyArray<LinkTag>;
151
- jsonLd?: Thing | WithContext<Thing>;
152
149
  }
153
150
 
154
151
  export interface JsonLdProps {