svelte-meta-tags 2.6.5 → 2.7.1

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/README.md CHANGED
@@ -40,6 +40,7 @@ This library is inspired by [next-seo](https://github.com/garmeeh/next-seo)
40
40
  - [Course](#course)
41
41
  - [DataSet](#dataset)
42
42
  - [FAQ](#faq)
43
+ - [JSON-LD Multiple Examples](#json-ld-multiple-examples)
43
44
  - [Types](#types)
44
45
  - [Additional types](#additional-types)
45
46
 
@@ -574,7 +575,7 @@ JSON-LD allows for more customized and richer display, such as in search results
574
575
 
575
576
  To discover all the different content types that JSON-LD offers, go to: https://developers.google.com/search/docs/guides/search-gallery
576
577
 
577
- It is also possible to use multiple `<JsonLd />` components in a single page.
578
+ Tips: If you want to handle multiple JSON-LDs on one page, pass an array to the `schema`.
578
579
 
579
580
  ### Using `schema-dts`
580
581
 
@@ -784,6 +785,68 @@ This plugin uses [schema-dts](https://github.com/google/schema-dts), so it provi
784
785
  />
785
786
  ```
786
787
 
788
+ ### JSON-LD Multiple Examples
789
+
790
+ ```svelte
791
+ <script>
792
+ import { JsonLd } from 'svelte-meta-tags';
793
+ </script>
794
+
795
+ <JsonLd
796
+ schema={[
797
+ {
798
+ '@type': 'BreadcrumbList',
799
+ itemListElement: [
800
+ {
801
+ '@type': 'ListItem',
802
+ position: 1,
803
+ name: 'Books',
804
+ item: 'https://example.com/books'
805
+ },
806
+ {
807
+ '@type': 'ListItem',
808
+ position: 2,
809
+ name: 'Science Fiction',
810
+ item: 'https://example.com/books/sciencefiction'
811
+ },
812
+ {
813
+ '@type': 'ListItem',
814
+ position: 3,
815
+ name: 'Award Winners'
816
+ }
817
+ ]
818
+ },
819
+ {
820
+ '@type': 'NewsArticle',
821
+ mainEntityOfPage: {
822
+ '@type': 'WebPage',
823
+ '@id': 'https://google.com/article'
824
+ },
825
+ headline: 'Article headline',
826
+ image: [
827
+ 'https://example.com/photos/1x1/photo.jpg',
828
+ 'https://example.com/photos/4x3/photo.jpg',
829
+ 'https://example.com/photos/16x9/photo.jpg'
830
+ ],
831
+ datePublished: '2015-02-05T08:00:00+08:00',
832
+ dateModified: '2015-02-05T09:20:00+08:00',
833
+ author: {
834
+ '@type': 'Person',
835
+ name: 'John Doe'
836
+ },
837
+ publisher: {
838
+ '@type': 'Organization',
839
+ name: 'Google',
840
+ logo: {
841
+ '@type': 'ImageObject',
842
+ url: 'https://google.com/logo.jpg'
843
+ }
844
+ }
845
+ }
846
+ ]}
847
+ />
848
+ ```
849
+
787
850
  ## Types
788
851
 
789
852
  The following types can be imported from `svelte-meta-tags`
@@ -814,7 +877,7 @@ interface MetaTagsProps {
814
877
  ```ts
815
878
  interface JsonLdProps {
816
879
  output?: 'head' | 'body';
817
- schema?: Thing | WithContext<Thing>;
880
+ schema?: Thing | WithContext<Thing> | Thing[] | WithContext<Thing>[];
818
881
  }
819
882
  ```
820
883
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-meta-tags",
3
- "version": "2.6.5",
3
+ "version": "2.7.1",
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",
@@ -18,36 +18,62 @@
18
18
  "url": "https://github.com/oekazuma/svelte-meta-tags"
19
19
  },
20
20
  "dependencies": {
21
- "schema-dts": "^1.1.0"
21
+ "schema-dts": "^1.1.2"
22
22
  },
23
23
  "devDependencies": {
24
- "@playwright/test": "^1.29.2",
25
- "@sveltejs/adapter-auto": "^1.0.2",
26
- "@sveltejs/kit": "^1.1.4",
27
- "@sveltejs/package": "^1.0.2",
28
- "@typescript-eslint/eslint-plugin": "^5.48.2",
29
- "@typescript-eslint/parser": "^5.48.2",
30
- "eslint": "^8.32.0",
31
- "eslint-config-prettier": "^8.6.0",
32
- "eslint-plugin-svelte3": "^4.0.0",
24
+ "@changesets/cli": "^2.26.1",
25
+ "@playwright/test": "^1.33.0",
26
+ "@sveltejs/adapter-auto": "^2.0.1",
27
+ "@sveltejs/kit": "^1.16.2",
28
+ "@sveltejs/package": "^2.0.2",
29
+ "@typescript-eslint/eslint-plugin": "^5.59.5",
30
+ "@typescript-eslint/parser": "^5.59.5",
31
+ "eslint": "^8.40.0",
32
+ "eslint-config-prettier": "^8.8.0",
33
+ "eslint-plugin-svelte": "^2.27.4",
33
34
  "husky": "^8.0.3",
34
- "lint-staged": "^13.1.0",
35
- "prettier": "^2.8.3",
36
- "prettier-plugin-svelte": "^2.9.0",
37
- "svelte": "^3.55.1",
38
- "svelte-check": "^3.0.2",
39
- "tslib": "^2.4.1",
40
- "typescript": "^4.9.4",
41
- "vite": "^4.0.4"
35
+ "lint-staged": "^13.2.2",
36
+ "prettier": "^2.8.8",
37
+ "prettier-plugin-svelte": "^2.10.0",
38
+ "publint": "^0.1.11",
39
+ "svelte": "^3.59.1",
40
+ "svelte-check": "^3.3.2",
41
+ "tslib": "^2.5.0",
42
+ "typescript": "^5.0.4",
43
+ "vite": "^4.3.5"
42
44
  },
43
45
  "peerDependencies": {
44
46
  "svelte": "^3.44.0"
45
47
  },
46
48
  "exports": {
47
- "./package.json": "./package.json",
48
- "./JsonLd.svelte": "./JsonLd.svelte",
49
- "./MetaTags.svelte": "./MetaTags.svelte",
50
- ".": "./index.js"
49
+ "./JsonLd.svelte": {
50
+ "types": "./dist/JsonLd.svelte.d.ts",
51
+ "svelte": "./dist/JsonLd.svelte"
52
+ },
53
+ "./MetaTags.svelte": {
54
+ "types": "./dist/MetaTags.svelte.d.ts",
55
+ "svelte": "./dist/MetaTags.svelte"
56
+ },
57
+ ".": {
58
+ "types": "./dist/index.d.ts",
59
+ "svelte": "./dist/index.js"
60
+ }
51
61
  },
52
- "svelte": "./index.js"
62
+ "files": [
63
+ "dist"
64
+ ],
65
+ "svelte": "./dist/index.js",
66
+ "types": "./dist/index.d.ts",
67
+ "scripts": {
68
+ "dev": "vite dev",
69
+ "build": "vite build",
70
+ "preview": "vite preview",
71
+ "package": "svelte-kit sync && svelte-package && publint",
72
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
73
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
74
+ "lint": "prettier --plugin-search-dir . --check . && eslint .",
75
+ "format": "prettier --plugin-search-dir . --write .",
76
+ "test": "playwright test",
77
+ "release": "changeset publish"
78
+ }
53
79
  }
package/CHANGELOG.md DELETED
@@ -1,181 +0,0 @@
1
- ## [2.6.4](https://github.com/oekazuma/svelte-meta-tags/compare/v2.6.3...v2.6.4) (2022-11-16)
2
-
3
- - add Svelte to peerDependencies([2d99894](https://github.com/oekazuma/svelte-meta-tags/commit/2d9989454e5ed51d9f4d0d9e9300ba933d0c0ffa))
4
-
5
- ## [2.6.3](https://github.com/oekazuma/svelte-meta-tags/compare/v2.6.2...v2.6.3) (2022-08-31)
6
-
7
- - add schema-dts to dependencies([9824e38](https://github.com/oekazuma/svelte-meta-tags/commit/9824e388728e37009aa06f56642ec4a2b9520921))
8
-
9
- ## [2.6.2](https://github.com/oekazuma/svelte-meta-tags/compare/v2.6.1...v2.6.2) (2022-08-11)
10
-
11
- - trim production dependencies([2008183](https://github.com/oekazuma/svelte-meta-tags/commit/2008183b0a712cc6288e188cabdb14c85f93b0ee))
12
-
13
- ## [2.6.1](https://github.com/oekazuma/svelte-meta-tags/compare/v2.6.0...v2.6.1) (2022-05-27)
14
-
15
- - clean up JSON-LD ([16d107c](https://github.com/oekazuma/svelte-meta-tags/commit/16d107c09546ffd6b2f8312a6851d46bd0da6ae1))
16
-
17
- # [2.6.0](https://github.com/oekazuma/svelte-meta-tags/compare/v2.5.5...v2.6.0) (2022-05-16)
18
-
19
- ### Features
20
-
21
- - allow all public type definitions to be retrieved ([3e04e2f](https://github.com/oekazuma/svelte-meta-tags/commit/3e04e2fd8ff8446709a7d015b5819971cb42765d))
22
-
23
- ## [2.5.5](https://github.com/oekazuma/svelte-meta-tags/compare/v2.5.4...v2.5.5) (2022-05-06)
24
-
25
- ### Bug Fixes
26
-
27
- - revert JSON.stringify options back to previous ([5160cec](https://github.com/oekazuma/svelte-meta-tags/commit/5160cec32f50a29a8e59aa87f851557444ad26a3))
28
-
29
- ## [2.5.4](https://github.com/oekazuma/svelte-meta-tags/compare/v2.5.3...v2.5.4) (2022-05-06)
30
-
31
- ### Bug Fixes
32
-
33
- - obfuscate by concatenating script tag ([fa9d409](https://github.com/oekazuma/svelte-meta-tags/commit/fa9d40960afc8b06d4aadc6a958fc05b6b15a96c))
34
-
35
- ## [2.5.3](https://github.com/oekazuma/svelte-meta-tags/compare/v2.5.2...v2.5.3) (2022-05-06)
36
-
37
- - escaping content in script tags ([25bf038](https://github.com/oekazuma/svelte-meta-tags/commit/25bf038a485697249ecc9633166599b0652f3550))
38
-
39
- ## [2.5.2](https://github.com/oekazuma/svelte-meta-tags/compare/v2.5.1...v2.5.2) (2022-05-06)
40
-
41
- - version bump for package
42
-
43
- ## [2.5.1](https://github.com/oekazuma/svelte-meta-tags/compare/v2.5.0...v2.5.1) (2022-03-22)
44
-
45
- ### Bug Fixes
46
-
47
- - fix title to be reactive([a19d30b](https://github.com/oekazuma/svelte-meta-tags/commit/a19d30bad9938d78360aea126012bfd7061fff3f))
48
-
49
- # [2.5.0](https://github.com/oekazuma/svelte-meta-tags/compare/v2.4.0...v2.5.0) (2022-03-19)
50
-
51
- ### Features
52
-
53
- - add titleTemplate property ([3a252e5](https://github.com/oekazuma/svelte-meta-tags/commit/3a252e5783d04456e32539d8bd3ca7646809fd0d))
54
-
55
- # [2.4.0](https://github.com/oekazuma/svelte-meta-tags/compare/v2.3.4...v2.4.0) (2022-03-12)
56
-
57
- ### Features
58
-
59
- - add a property that allows selection of whether to output JSON-LD in the head or in the body ([91c9c38](https://github.com/oekazuma/svelte-meta-tags/commit/91c9c3861d5cc9168a6b3d90c2cf734f5c03f890))
60
-
61
- ## [2.3.4](https://github.com/oekazuma/svelte-meta-tags/compare/v2.3.3...v2.3.4) (2022-03-03)
62
-
63
- ### Bug Fixes
64
-
65
- - add pnpm build to release command ([1c01f61](https://github.com/oekazuma/svelte-meta-tags/commit/1c01f619c5cd1dee51c58f4067fd315907fb4753))
66
-
67
- ## [2.3.3](https://github.com/oekazuma/svelte-meta-tags/compare/v2.3.2...v2.3.3) (2022-03-03)
68
-
69
- ### Bug Fixes
70
-
71
- - fix tsconfig.json ([bd54216](https://github.com/oekazuma/svelte-meta-tags/commit/bd542167bc0f377157d7337b9eb2e9b58d63a625))
72
-
73
- ## [2.3.2](https://github.com/oekazuma/svelte-meta-tags/compare/v2.3.1...v2.3.2) (2022-02-28)
74
-
75
- ### Bug Fixes
76
-
77
- - **deps:** update dependency schema-dts to v1.1.0 ([d57c99d](https://github.com/oekazuma/svelte-meta-tags/commit/d57c99d89b5071e1e2045892ee2814a7105251ce))
78
-
79
- ## [2.3.1](https://github.com/oekazuma/svelte-meta-tags/compare/v2.3.0...v2.3.1) (2022-02-25)
80
-
81
- ### Bug Fixes
82
-
83
- - fix lint error in `@typescript-eslint/no-empty-interface` ([6f41cc4](https://github.com/oekazuma/svelte-meta-tags/commit/6f41cc4e0d0022b1be6c778d4520bdd7b0188127))
84
-
85
- # [2.3.0](https://github.com/oekazuma/svelte-meta-tags/compare/v2.2.3...v2.3.0) (2022-01-28)
86
-
87
- ### Features
88
-
89
- - add twitter title description image imageAlt ([e3270f5](https://github.com/oekazuma/svelte-meta-tags/commit/e3270f54fda56483a192d34dfc9d589c7949fc5b))
90
-
91
- ## [2.2.3](https://github.com/oekazuma/svelte-meta-tags/compare/v2.2.2...v2.2.3) (2022-01-14)
92
-
93
- ### Bug Fixes
94
-
95
- - fix path to type definitions ([7c49639](https://github.com/oekazuma/svelte-meta-tags/commit/7c49639c1f08fe6ee6ea3e036c9982b1c1979c77))
96
-
97
- ## [2.2.2](https://github.com/oekazuma/svelte-meta-tags/compare/v2.2.1...v2.2.2) (2021-12-26)
98
-
99
- ### Bug Fixes
100
-
101
- - revert changes so that npm and yarn can also be used for installation ([f536977](https://github.com/oekazuma/svelte-meta-tags/commit/f536977550948f675f4207b80dc5aca96cc535a0))
102
-
103
- ## [2.2.1](https://github.com/oekazuma/svelte-meta-tags/compare/v2.2.0...v2.2.1) (2021-12-21)
104
-
105
- ### Bug Fixes
106
-
107
- - make the schema property of jsonLdProps not mandatory ([15f00f9](https://github.com/oekazuma/svelte-meta-tags/commit/15f00f9940fdcb8ac9a8c8f6ed51782bd5789ebd))
108
-
109
- # [2.2.0](https://github.com/oekazuma/svelte-meta-tags/compare/v2.1.0...v2.2.0) (2021-12-17)
110
-
111
- ### Features
112
-
113
- - improved Twitter's CardType type definition ([13b11fd](https://github.com/oekazuma/svelte-meta-tags/commit/13b11fd2e9f6625e1cd0802e825f312f37988666))
114
-
115
- # [2.1.0](https://github.com/oekazuma/svelte-meta-tags/compare/v2.0.0...v2.1.0) (2021-11-04)
116
-
117
- ### Features
118
-
119
- - allow title to be dynamically changed ([b9acefb](https://github.com/oekazuma/svelte-meta-tags/commit/b9acefbea7c64b5434837ffecc17423dcf0ce2d3))
120
-
121
- # [2.0.0](https://github.com/oekazuma/svelte-meta-tags/compare/v1.2.2...v2.0.0) (2021-09-18)
122
-
123
- ### chore
124
-
125
- - change name the MetaTags export ([d40b535](https://github.com/oekazuma/svelte-meta-tags/commit/d40b535249be8b629ba1034358865aa08993927c))
126
- - remove jsonLd property from MetaTags component ([a05ae2b](https://github.com/oekazuma/svelte-meta-tags/commit/a05ae2b72a8605253a50249e8f76ee76cbe1411d))
127
-
128
- ### BREAKING CHANGES
129
-
130
- - Change the way import is written.
131
- - Remove jsonLd parameter from MetaTags component.
132
- Please use the JsonLd component from now on.
133
-
134
- ## [1.2.2](https://github.com/oekazuma/svelte-meta-tags/compare/v1.2.1...v1.2.2) (2021-09-07)
135
-
136
- ### Bug Fixes
137
-
138
- - fix types in package.json ([7be485a](https://github.com/oekazuma/svelte-meta-tags/commit/7be485a880203ce2038ea91768031fbbf66d32b5))
139
-
140
- ## [1.2.1](https://github.com/oekazuma/svelte-meta-tags/compare/v1.2.0...v1.2.1) (2021-09-07)
141
-
142
- ### Bug Fixes
143
-
144
- - restore the emitTypes setting of package ([20d8a85](https://github.com/oekazuma/svelte-meta-tags/commit/20d8a85ab0f76a1a7c270cdf3a1062eb83c1aa59))
145
-
146
- # [1.2.0](https://github.com/oekazuma/svelte-meta-tags/compare/v1.1.1...v1.2.0) (2021-09-07)
147
-
148
- ### Features
149
-
150
- - import types to make them easier to use ([cdceda7](https://github.com/oekazuma/svelte-meta-tags/commit/cdceda73204d668f80cb2773b73e252e53d0d6a1))
151
-
152
- ## [1.1.1](https://github.com/oekazuma/svelte-meta-tags/compare/v1.1.0...v1.1.1) (2021-09-02)
153
-
154
- ### Bug Fixes
155
-
156
- - update package.json ([cd0574c](https://github.com/oekazuma/svelte-meta-tags/commit/cd0574cf04050d3f8a031556ff20628aa390c671))
157
-
158
- # [1.1.0](https://github.com/oekazuma/svelte-meta-tags/compare/v1.0.5...v1.1.0) (2021-08-30)
159
-
160
- ### Features
161
-
162
- - separate JSON-LD from MetaTags component ([43698ab](https://github.com/oekazuma/svelte-meta-tags/commit/43698ab9b98781f3b9ff246640c1e29ab772ba75))
163
-
164
- ## [1.0.5](https://github.com/oekazuma/svelte-meta-tags/compare/v1.0.4...v1.0.5) (2021-08-30)
165
-
166
- ### Bug Fixes
167
-
168
- - **deps:** update dependency schema-dts to v1 ([a13737a](https://github.com/oekazuma/svelte-meta-tags/commit/a13737a621d0a199b18dea55324b06ff9478fce1))
169
-
170
- ## [1.0.4](https://github.com/oekazuma/svelte-meta-tags/compare/v1.0.3...v1.0.4) (2021-08-27)
171
-
172
- ### Bug Fixes
173
-
174
- - pkgRoot settings to semantic-releas ([c52e674](https://github.com/oekazuma/svelte-meta-tags/commit/c52e674e9240cc61eb4cbe062f483f96dbf02b1a))
175
-
176
- ## [1.0.3](https://github.com/oekazuma/svelte-meta-tags/compare/v1.0.2...v1.0.3) (2021-08-27)
177
-
178
- ### Bug Fixes
179
-
180
- - change branch to branches ([0c4c0e3](https://github.com/oekazuma/svelte-meta-tags/commit/0c4c0e346ee63648bc771033b828a19324739d68))
181
- - change commitlint type-enum ([0b84c33](https://github.com/oekazuma/svelte-meta-tags/commit/0b84c33e32b1e59c8a7deb3e45d6cece28069eaa))
package/JsonLd.svelte DELETED
@@ -1,20 +0,0 @@
1
- <script>
2
- export let output = 'head';
3
- export let schema = {};
4
-
5
- $: isValid = schema && typeof schema === 'object';
6
- $: json = `${'<scri' + 'pt type="application/ld+json">'}${JSON.stringify({
7
- '@context': 'https://schema.org',
8
- ...schema
9
- })}${'</scri' + 'pt>'}`;
10
- </script>
11
-
12
- <svelte:head>
13
- {#if isValid && output === 'head'}
14
- {@html json}
15
- {/if}
16
- </svelte:head>
17
-
18
- {#if isValid && output === 'body'}
19
- {@html json}
20
- {/if}
@@ -1,4 +0,0 @@
1
- import { SvelteComponentTyped } from 'svelte';
2
- import { JsonLdProps } from './types';
3
-
4
- export default class JsonLd extends SvelteComponentTyped<JsonLdProps> {}
package/MetaTags.svelte DELETED
@@ -1,274 +0,0 @@
1
- <script>
2
- export let title = '';
3
- export let titleTemplate = '';
4
- export let noindex = false;
5
- export let nofollow = false;
6
- export let robotsProps = undefined;
7
- export let description = undefined;
8
- export let mobileAlternate = undefined;
9
- export let languageAlternates = undefined;
10
- export let twitter = undefined;
11
- export let facebook = undefined;
12
- export let openGraph = undefined;
13
- export let canonical = undefined;
14
- export let additionalMetaTags = undefined;
15
- export let additionalLinkTags = undefined;
16
-
17
- $: updatedTitle = titleTemplate ? titleTemplate.replace(/%s/g, title) : title;
18
-
19
- let robotsParams = '';
20
- if (robotsProps) {
21
- const {
22
- nosnippet,
23
- maxSnippet,
24
- maxImagePreview,
25
- maxVideoPreview,
26
- noarchive,
27
- noimageindex,
28
- notranslate,
29
- unavailableAfter
30
- } = robotsProps;
31
-
32
- robotsParams = `${nosnippet ? ',nosnippet' : ''}${maxSnippet ? `,max-snippet:${maxSnippet}` : ''}${
33
- maxImagePreview ? `,max-image-preview:${maxImagePreview}` : ''
34
- }${noarchive ? ',noarchive' : ''}${unavailableAfter ? `,unavailable_after:${unavailableAfter}` : ''}${
35
- noimageindex ? ',noimageindex' : ''
36
- }${maxVideoPreview ? `,max-video-preview:${maxVideoPreview}` : ''}${notranslate ? ',notranslate' : ''}`;
37
- }
38
- </script>
39
-
40
- <svelte:head>
41
- <title>{updatedTitle}</title>
42
-
43
- <meta name="robots" content={`${noindex ? 'noindex' : 'index'},${nofollow ? 'nofollow' : 'follow'}${robotsParams}`} />
44
- <meta
45
- name="googlebot"
46
- content={`${noindex ? 'noindex' : 'index'},${nofollow ? 'nofollow' : 'follow'}${robotsParams}`}
47
- />
48
-
49
- {#if description}
50
- <meta name="description" content={description} />
51
- {/if}
52
-
53
- {#if canonical}
54
- <link rel="canonical" href={canonical} />
55
- {/if}
56
-
57
- {#if mobileAlternate}
58
- <link rel="alternate" media={mobileAlternate.media} href={mobileAlternate.href} />
59
- {/if}
60
-
61
- {#if languageAlternates && languageAlternates.length > 0}
62
- {#each languageAlternates as languageAlternate}
63
- <link rel="alternate" hrefLang={languageAlternate.hrefLang} href={languageAlternate.href} />
64
- {/each}
65
- {/if}
66
-
67
- {#if twitter}
68
- {#if twitter.cardType}
69
- <meta name="twitter:card" content={twitter.cardType} />
70
- {/if}
71
- {#if twitter.site}
72
- <meta name="twitter:site" content={twitter.site} />
73
- {/if}
74
- {#if twitter.handle}
75
- <meta name="twitter:creator" content={twitter.handle} />
76
- {/if}
77
- {#if twitter.title}
78
- <meta name="twitter:title" content={twitter.title} />
79
- {/if}
80
- {#if twitter.description}
81
- <meta name="twitter:description" content={twitter.description} />
82
- {/if}
83
- {#if twitter.image}
84
- <meta name="twitter:image" content={twitter.image} />
85
- {/if}
86
- {#if twitter.imageAlt}
87
- <meta name="twitter:image:alt" content={twitter.imageAlt} />
88
- {/if}
89
- {/if}
90
-
91
- {#if facebook}
92
- <meta property="fb:app_id" content={facebook.appId} />
93
- {/if}
94
-
95
- {#if openGraph}
96
- {#if openGraph.url || canonical}
97
- <meta property="og:url" content={openGraph.url || canonical} />
98
- {/if}
99
-
100
- {#if openGraph.type}
101
- <meta property="og:type" content={openGraph.type.toLowerCase()} />
102
- {#if openGraph.type.toLowerCase() === 'profile' && openGraph.profile}
103
- {#if openGraph.profile.firstName}
104
- <meta property="profile:first_name" content={openGraph.profile.firstName} />
105
- {/if}
106
-
107
- {#if openGraph.profile.lastName}
108
- <meta property="profile:last_name" content={openGraph.profile.lastName} />
109
- {/if}
110
-
111
- {#if openGraph.profile.username}
112
- <meta property="profile:username" content={openGraph.profile.username} />
113
- {/if}
114
-
115
- {#if openGraph.profile.gender}
116
- <meta property="profile:gender" content={openGraph.profile.gender} />
117
- {/if}
118
- {:else if openGraph.type.toLowerCase() === 'book' && openGraph.book}
119
- {#if openGraph.book.authors && openGraph.book.authors.length}
120
- {#each openGraph.book.authors as author}
121
- <meta property="book:author" content={author} />
122
- {/each}
123
- {/if}
124
-
125
- {#if openGraph.book.isbn}
126
- <meta property="book:isbn" content={openGraph.book.isbn} />
127
- {/if}
128
-
129
- {#if openGraph.book.releaseDate}
130
- <meta property="book:release_date" content={openGraph.book.releaseDate} />
131
- {/if}
132
-
133
- {#if openGraph.book.tags && openGraph.book.tags.length}
134
- {#each openGraph.book.tags as tag}
135
- <meta property="book:tag" content={tag} />
136
- {/each}
137
- {/if}
138
- {:else if openGraph.type.toLowerCase() === 'article' && openGraph.article}
139
- {#if openGraph.article.publishedTime}
140
- <meta property="article:published_time" content={openGraph.article.publishedTime} />
141
- {/if}
142
-
143
- {#if openGraph.article.modifiedTime}
144
- <meta property="article:modified_time" content={openGraph.article.modifiedTime} />
145
- {/if}
146
-
147
- {#if openGraph.article.expirationTime}
148
- <meta property="article:expiration_time" content={openGraph.article.expirationTime} />
149
- {/if}
150
-
151
- {#if openGraph.article.authors && openGraph.article.authors.length}
152
- {#each openGraph.article.authors as author}
153
- <meta property="article:author" content={author} />
154
- {/each}
155
- {/if}
156
-
157
- {#if openGraph.article.section}
158
- <meta property="article:section" content={openGraph.article.section} />
159
- {/if}
160
-
161
- {#if openGraph.article.tags && openGraph.article.tags.length}
162
- {#each openGraph.article.tags as tag}
163
- <meta property="article:tag" content={tag} />
164
- {/each}
165
- {/if}
166
- {:else if openGraph.type.toLowerCase() === 'video.movie' || openGraph.type.toLowerCase() === 'video.episode' || openGraph.type.toLowerCase() === 'video.tv_show' || (openGraph.type.toLowerCase() === 'video.other' && openGraph.video)}
167
- {#if openGraph.video.actors && openGraph.video.actors.length}
168
- {#each openGraph.video.actors as actor}
169
- {#if actor.profile}
170
- <meta property="video:actor" content={actor.profile} />
171
- {/if}
172
- {#if actor.role}
173
- <meta property="video:actor:role" content={actor.role} />
174
- {/if}
175
- {/each}
176
- {/if}
177
-
178
- {#if openGraph.video.directors && openGraph.video.directors.length}
179
- {#each openGraph.video.directors as director}
180
- <meta property="video:director" content={director} />
181
- {/each}
182
- {/if}
183
-
184
- {#if openGraph.video.writers && openGraph.video.writers.length}
185
- {#each openGraph.video.writers as writer}
186
- <meta property="video:writer" content={writer} />
187
- {/each}
188
- {/if}
189
-
190
- {#if openGraph.video.duration}
191
- <meta property="video:duration" content={openGraph.video.duration.toString()} />
192
- {/if}
193
-
194
- {#if openGraph.video.releaseDate}
195
- <meta property="video:release_date" content={openGraph.video.releaseDate} />
196
- {/if}
197
-
198
- {#if openGraph.video.tags && openGraph.video.tags.length}
199
- {#each openGraph.video.tags as tag}
200
- <meta property="video:tag" content={tag} />
201
- {/each}
202
- {/if}
203
-
204
- {#if openGraph.video.series}
205
- <meta property="video:series" content={openGraph.video.series} />
206
- {/if}
207
- {/if}
208
- {/if}
209
-
210
- {#if openGraph.title || updatedTitle}
211
- <meta property="og:title" content={openGraph.title || updatedTitle} />
212
- {/if}
213
-
214
- {#if openGraph.description || description}
215
- <meta property="og:description" content={openGraph.description || description} />
216
- {/if}
217
-
218
- {#if openGraph.images && openGraph.images.length}
219
- {#each openGraph.images as image}
220
- <meta property="og:image" content={image.url} />
221
- {#if image.alt}
222
- <meta property="og:image:alt" content={image.alt} />
223
- {/if}
224
- {#if image.width}
225
- <meta property="og:image:width" content={image.width.toString()} />
226
- {/if}
227
- {#if image.height}
228
- <meta property="og:image:height" content={image.height.toString()} />
229
- {/if}
230
- {/each}
231
- {/if}
232
-
233
- {#if openGraph.videos && openGraph.videos.length}
234
- {#each openGraph.videos as video}
235
- <meta property="og:video" content={video.url} />
236
- {#if video.alt}
237
- <meta property="og:video:alt" content={video.alt} />
238
- {/if}
239
- {#if video.width}
240
- <meta property="og:video:width" content={video.width.toString()} />
241
- {/if}
242
- {#if video.height}
243
- <meta property="og:video:height" content={video.height.toString()} />
244
- {/if}
245
- {#if video.secureUrl}
246
- <meta property="og:video:secure_url" content={video.secureUrl.toString()} />
247
- {/if}
248
- {#if video.type}
249
- <meta property="og:video:type" content={video.type.toString()} />
250
- {/if}
251
- {/each}
252
- {/if}
253
-
254
- {#if openGraph.locale}
255
- <meta property="og:locale" content={openGraph.locale} />
256
- {/if}
257
-
258
- {#if openGraph.site_name}
259
- <meta property="og:site_name" content={openGraph.site_name} />
260
- {/if}
261
- {/if}
262
-
263
- {#if additionalMetaTags && additionalMetaTags.length > 0}
264
- {#each additionalMetaTags as tag}
265
- <meta {...tag} />
266
- {/each}
267
- {/if}
268
-
269
- {#if additionalLinkTags?.length}
270
- {#each additionalLinkTags as tag}
271
- <link {...tag} />
272
- {/each}
273
- {/if}
274
- </svelte:head>
@@ -1,4 +0,0 @@
1
- import { SvelteComponentTyped } from 'svelte';
2
- import { MetaTagsProps } from './types';
3
-
4
- export default class MetaTags extends SvelteComponentTyped<MetaTagsProps> {}
package/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { default as MetaTags } from './MetaTags.svelte';
2
- export { default as JsonLd } from './JsonLd.svelte';
3
- export type { MetaTagsProps, JsonLdProps, AdditionalRobotsProps, MobileAlternate, LanguageAlternate, Twitter, Facebook, OpenGraph, MetaTag, LinkTag } from './types';
package/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { default as MetaTags } from './MetaTags.svelte';
2
- export { default as JsonLd } from './JsonLd.svelte';
package/types.d.ts DELETED
@@ -1,154 +0,0 @@
1
- import { Thing, WithContext } from 'schema-dts';
2
-
3
- export interface MobileAlternate {
4
- media: string;
5
- href: string;
6
- }
7
-
8
- export interface LanguageAlternate {
9
- hrefLang: string;
10
- href: string;
11
- }
12
-
13
- export interface AdditionalRobotsProps {
14
- nosnippet?: boolean;
15
- maxSnippet?: number;
16
- maxImagePreview?: 'none' | 'standard' | 'large';
17
- maxVideoPreview?: number;
18
- noarchive?: boolean;
19
- unavailableAfter?: string;
20
- noimageindex?: boolean;
21
- notranslate?: boolean;
22
- }
23
- export interface Twitter {
24
- cardType?: 'summary' | 'summary_large_image' | 'app' | 'player';
25
- site?: string;
26
- handle?: string;
27
- title?: string;
28
- description?: string;
29
- image?: string;
30
- imageAlt?: string;
31
- }
32
-
33
- export interface Facebook {
34
- appId?: string;
35
- }
36
-
37
- export interface OpenGraph {
38
- url?: string;
39
- type?: string;
40
- title?: string;
41
- description?: string;
42
- images?: ReadonlyArray<OpenGraphImages>;
43
- videos?: ReadonlyArray<OpenGraphVideos>;
44
- locale?: string;
45
- site_name?: string;
46
- profile?: OpenGraphProfile;
47
- book?: OpenGraphBook;
48
- article?: OpenGraphArticle;
49
- video?: OpenGraphVideo;
50
- }
51
- interface OpenGraphImages {
52
- url: string;
53
- alt?: string;
54
- width?: number;
55
- height?: number;
56
- }
57
- interface OpenGraphVideos {
58
- url: string;
59
- alt?: string;
60
- width?: number;
61
- height?: number;
62
- secureUrl?: string;
63
- type?: string;
64
- }
65
- interface OpenGraphProfile {
66
- firstName?: string;
67
- lastName?: string;
68
- username?: string;
69
- gender?: string;
70
- }
71
-
72
- interface OpenGraphBook {
73
- authors?: ReadonlyArray<string>;
74
- isbn?: string;
75
- releaseDate?: string;
76
- tags?: ReadonlyArray<string>;
77
- }
78
- interface OpenGraphArticle {
79
- publishedTime?: string;
80
- modifiedTime?: string;
81
- expirationTime?: string;
82
- authors?: ReadonlyArray<string>;
83
- section?: string;
84
- tags?: ReadonlyArray<string>;
85
- }
86
-
87
- interface OpenGraphVideo {
88
- actors?: ReadonlyArray<OpenGraphVideoActors>;
89
- directors?: ReadonlyArray<string>;
90
- writers?: ReadonlyArray<string>;
91
- duration?: number;
92
- releaseDate?: string;
93
- tags?: ReadonlyArray<string>;
94
- series?: string;
95
- }
96
-
97
- interface OpenGraphVideoActors {
98
- profile: string;
99
- role?: string;
100
- }
101
-
102
- interface BaseMetaTag {
103
- content: string;
104
- }
105
-
106
- interface HTML5MetaTag extends BaseMetaTag {
107
- name: string;
108
- property?: undefined;
109
- httpEquiv?: undefined;
110
- }
111
-
112
- interface RDFaMetaTag extends BaseMetaTag {
113
- property: string;
114
- name?: undefined;
115
- httpEquiv?: undefined;
116
- }
117
-
118
- interface HTTPEquivMetaTag extends BaseMetaTag {
119
- httpEquiv: 'content-security-policy' | 'content-type' | 'default-style' | 'x-ua-compatible' | 'refresh';
120
- name?: undefined;
121
- property?: undefined;
122
- }
123
-
124
- export type MetaTag = HTML5MetaTag | RDFaMetaTag | HTTPEquivMetaTag;
125
-
126
- export interface LinkTag {
127
- rel: string;
128
- href: string;
129
- sizes?: string;
130
- type?: string;
131
- color?: string;
132
- }
133
-
134
- export interface MetaTagsProps {
135
- title?: string;
136
- titleTemplate?: string;
137
- noindex?: boolean;
138
- nofollow?: boolean;
139
- robotsProps?: AdditionalRobotsProps;
140
- description?: string;
141
- canonical?: string;
142
- mobileAlternate?: MobileAlternate;
143
- languageAlternates?: ReadonlyArray<LanguageAlternate>;
144
- twitter?: Twitter;
145
- facebook?: Facebook;
146
- openGraph?: OpenGraph;
147
- additionalMetaTags?: ReadonlyArray<MetaTag>;
148
- additionalLinkTags?: ReadonlyArray<LinkTag>;
149
- }
150
-
151
- export interface JsonLdProps {
152
- output?: 'head' | 'body';
153
- schema?: Thing | WithContext<Thing>;
154
- }