svelte-meta
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -266,2 +266,5 @@ (function (global, factory) { | ||
} | ||
/** | ||
* Base class for Svelte components. Used when dev=false. | ||
*/ | ||
class SvelteComponent { | ||
@@ -290,3 +293,3 @@ $destroy() { | ||
/* Meta.svelte generated by Svelte v3.29.4 */ | ||
/* src/Meta.svelte generated by Svelte v3.31.0 */ | ||
@@ -305,27 +308,3 @@ function get_each_context(ctx, list, i) { | ||
// (50:2) {#if robots} | ||
function create_if_block_6(ctx) { | ||
let meta; | ||
return { | ||
c() { | ||
meta = element("meta"); | ||
attr(meta, "name", "robots"); | ||
attr(meta, "content", /*robots*/ ctx[8]); | ||
}, | ||
m(target, anchor) { | ||
insert(target, meta, anchor); | ||
}, | ||
p(ctx, dirty) { | ||
if (dirty & /*robots*/ 256) { | ||
attr(meta, "content", /*robots*/ ctx[8]); | ||
} | ||
}, | ||
d(detaching) { | ||
if (detaching) detach(meta); | ||
} | ||
}; | ||
} | ||
// (54:2) {#if title} | ||
// (79:2) {#if title} | ||
function create_if_block_5(ctx) { | ||
@@ -364,3 +343,3 @@ let title_value; | ||
// (59:2) {#if description} | ||
// (84:2) {#if description} | ||
function create_if_block_4(ctx) { | ||
@@ -389,3 +368,3 @@ let meta; | ||
// (63:2) {#if url} | ||
// (88:2) {#if url} | ||
function create_if_block_3(ctx) { | ||
@@ -414,3 +393,3 @@ let link; | ||
// (67:2) {#if sitemapUrl} | ||
// (92:2) {#if sitemapUrl} | ||
function create_if_block_2(ctx) { | ||
@@ -440,3 +419,3 @@ let link; | ||
// (71:2) {#each Object.keys(twitter) as tag} | ||
// (96:2) {#each Object.keys(twitter) as tag} | ||
function create_each_block_1(ctx) { | ||
@@ -471,3 +450,3 @@ let meta; | ||
// (75:2) {#each Object.keys(openGraph) as tag} | ||
// (100:2) {#each Object.keys(openGraph) as tag} | ||
function create_each_block(ctx) { | ||
@@ -502,3 +481,3 @@ let meta; | ||
// (79:2) {#if url && logoUrl} | ||
// (104:2) {#if url && logoUrl} | ||
function create_if_block_1(ctx) { | ||
@@ -540,3 +519,3 @@ let html_tag; | ||
// (88:2) {#if url && searchUrl} | ||
// (113:2) {#if url && searchUrl} | ||
function create_if_block(ctx) { | ||
@@ -590,2 +569,3 @@ let html_tag; | ||
let meta2; | ||
let meta3; | ||
let if_block0_anchor; | ||
@@ -595,12 +575,10 @@ let if_block1_anchor; | ||
let if_block3_anchor; | ||
let if_block4_anchor; | ||
let each0_anchor; | ||
let each1_anchor; | ||
let if_block4_anchor; | ||
let if_block5_anchor; | ||
let if_block6_anchor; | ||
let if_block0 = /*robots*/ ctx[8] && create_if_block_6(ctx); | ||
let if_block1 = /*title*/ ctx[2] && create_if_block_5(ctx); | ||
let if_block2 = /*description*/ ctx[3] && create_if_block_4(ctx); | ||
let if_block3 = /*url*/ ctx[4] && create_if_block_3(ctx); | ||
let if_block4 = /*sitemapUrl*/ ctx[7] && create_if_block_2(ctx); | ||
let if_block0 = /*title*/ ctx[2] && create_if_block_5(ctx); | ||
let if_block1 = /*description*/ ctx[3] && create_if_block_4(ctx); | ||
let if_block2 = /*url*/ ctx[4] && create_if_block_3(ctx); | ||
let if_block3 = /*sitemapUrl*/ ctx[7] && create_if_block_2(ctx); | ||
let each_value_1 = Object.keys(/*twitter*/ ctx[0]); | ||
@@ -620,4 +598,4 @@ let each_blocks_1 = []; | ||
let if_block5 = /*url*/ ctx[4] && /*logoUrl*/ ctx[5] && create_if_block_1(ctx); | ||
let if_block6 = /*url*/ ctx[4] && /*searchUrl*/ ctx[6] && create_if_block(ctx); | ||
let if_block4 = /*url*/ ctx[4] && /*logoUrl*/ ctx[5] && create_if_block_1(ctx); | ||
let if_block5 = /*url*/ ctx[4] && /*searchUrl*/ ctx[6] && create_if_block(ctx); | ||
@@ -629,2 +607,3 @@ return { | ||
meta2 = element("meta"); | ||
meta3 = element("meta"); | ||
if (if_block0) if_block0.c(); | ||
@@ -638,4 +617,2 @@ if_block0_anchor = empty(); | ||
if_block3_anchor = empty(); | ||
if (if_block4) if_block4.c(); | ||
if_block4_anchor = empty(); | ||
@@ -653,6 +630,6 @@ for (let i = 0; i < each_blocks_1.length; i += 1) { | ||
each1_anchor = empty(); | ||
if (if_block4) if_block4.c(); | ||
if_block4_anchor = empty(); | ||
if (if_block5) if_block5.c(); | ||
if_block5_anchor = empty(); | ||
if (if_block6) if_block6.c(); | ||
if_block6_anchor = empty(); | ||
attr(meta0, "charset", "utf-8"); | ||
@@ -663,2 +640,4 @@ attr(meta1, "http-equiv", "x-ua-compatible"); | ||
attr(meta2, "content", "width=device-width, initial-scale=1, shrink-to-fit=no"); | ||
attr(meta3, "name", "robots"); | ||
attr(meta3, "content", /*robots*/ ctx[8]); | ||
}, | ||
@@ -669,2 +648,3 @@ m(target, anchor) { | ||
append(document.head, meta2); | ||
append(document.head, meta3); | ||
if (if_block0) if_block0.m(document.head, null); | ||
@@ -678,4 +658,2 @@ append(document.head, if_block0_anchor); | ||
append(document.head, if_block3_anchor); | ||
if (if_block4) if_block4.m(document.head, null); | ||
append(document.head, if_block4_anchor); | ||
@@ -693,13 +671,17 @@ for (let i = 0; i < each_blocks_1.length; i += 1) { | ||
append(document.head, each1_anchor); | ||
if (if_block4) if_block4.m(document.head, null); | ||
append(document.head, if_block4_anchor); | ||
if (if_block5) if_block5.m(document.head, null); | ||
append(document.head, if_block5_anchor); | ||
if (if_block6) if_block6.m(document.head, null); | ||
append(document.head, if_block6_anchor); | ||
}, | ||
p(ctx, [dirty]) { | ||
if (/*robots*/ ctx[8]) { | ||
if (dirty & /*robots*/ 256) { | ||
attr(meta3, "content", /*robots*/ ctx[8]); | ||
} | ||
if (/*title*/ ctx[2]) { | ||
if (if_block0) { | ||
if_block0.p(ctx, dirty); | ||
} else { | ||
if_block0 = create_if_block_6(ctx); | ||
if_block0 = create_if_block_5(ctx); | ||
if_block0.c(); | ||
@@ -713,7 +695,7 @@ if_block0.m(if_block0_anchor.parentNode, if_block0_anchor); | ||
if (/*title*/ ctx[2]) { | ||
if (/*description*/ ctx[3]) { | ||
if (if_block1) { | ||
if_block1.p(ctx, dirty); | ||
} else { | ||
if_block1 = create_if_block_5(ctx); | ||
if_block1 = create_if_block_4(ctx); | ||
if_block1.c(); | ||
@@ -727,7 +709,7 @@ if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); | ||
if (/*description*/ ctx[3]) { | ||
if (/*url*/ ctx[4]) { | ||
if (if_block2) { | ||
if_block2.p(ctx, dirty); | ||
} else { | ||
if_block2 = create_if_block_4(ctx); | ||
if_block2 = create_if_block_3(ctx); | ||
if_block2.c(); | ||
@@ -741,7 +723,7 @@ if_block2.m(if_block2_anchor.parentNode, if_block2_anchor); | ||
if (/*url*/ ctx[4]) { | ||
if (/*sitemapUrl*/ ctx[7]) { | ||
if (if_block3) { | ||
if_block3.p(ctx, dirty); | ||
} else { | ||
if_block3 = create_if_block_3(ctx); | ||
if_block3 = create_if_block_2(ctx); | ||
if_block3.c(); | ||
@@ -755,15 +737,2 @@ if_block3.m(if_block3_anchor.parentNode, if_block3_anchor); | ||
if (/*sitemapUrl*/ ctx[7]) { | ||
if (if_block4) { | ||
if_block4.p(ctx, dirty); | ||
} else { | ||
if_block4 = create_if_block_2(ctx); | ||
if_block4.c(); | ||
if_block4.m(if_block4_anchor.parentNode, if_block4_anchor); | ||
} | ||
} else if (if_block4) { | ||
if_block4.d(1); | ||
if_block4 = null; | ||
} | ||
if (dirty & /*Object, twitter*/ 1) { | ||
@@ -816,6 +785,19 @@ each_value_1 = Object.keys(/*twitter*/ ctx[0]); | ||
if (/*url*/ ctx[4] && /*logoUrl*/ ctx[5]) { | ||
if (if_block4) { | ||
if_block4.p(ctx, dirty); | ||
} else { | ||
if_block4 = create_if_block_1(ctx); | ||
if_block4.c(); | ||
if_block4.m(if_block4_anchor.parentNode, if_block4_anchor); | ||
} | ||
} else if (if_block4) { | ||
if_block4.d(1); | ||
if_block4 = null; | ||
} | ||
if (/*url*/ ctx[4] && /*searchUrl*/ ctx[6]) { | ||
if (if_block5) { | ||
if_block5.p(ctx, dirty); | ||
} else { | ||
if_block5 = create_if_block_1(ctx); | ||
if_block5 = create_if_block(ctx); | ||
if_block5.c(); | ||
@@ -828,15 +810,2 @@ if_block5.m(if_block5_anchor.parentNode, if_block5_anchor); | ||
} | ||
if (/*url*/ ctx[4] && /*searchUrl*/ ctx[6]) { | ||
if (if_block6) { | ||
if_block6.p(ctx, dirty); | ||
} else { | ||
if_block6 = create_if_block(ctx); | ||
if_block6.c(); | ||
if_block6.m(if_block6_anchor.parentNode, if_block6_anchor); | ||
} | ||
} else if (if_block6) { | ||
if_block6.d(1); | ||
if_block6 = null; | ||
} | ||
}, | ||
@@ -849,2 +818,3 @@ i: noop, | ||
detach(meta2); | ||
detach(meta3); | ||
if (if_block0) if_block0.d(detaching); | ||
@@ -858,4 +828,2 @@ detach(if_block0_anchor); | ||
detach(if_block3_anchor); | ||
if (if_block4) if_block4.d(detaching); | ||
detach(if_block4_anchor); | ||
destroy_each(each_blocks_1, detaching); | ||
@@ -865,6 +833,6 @@ detach(each0_anchor); | ||
detach(each1_anchor); | ||
if (if_block4) if_block4.d(detaching); | ||
detach(if_block4_anchor); | ||
if (if_block5) if_block5.d(detaching); | ||
detach(if_block5_anchor); | ||
if (if_block6) if_block6.d(detaching); | ||
detach(if_block6_anchor); | ||
} | ||
@@ -877,3 +845,3 @@ }; | ||
let { description = undefined } = $$props; | ||
let { image } = $$props; | ||
let { image = undefined } = $$props; | ||
let { url = undefined } = $$props; | ||
@@ -884,3 +852,10 @@ let { logoUrl = undefined } = $$props; | ||
let { twitter = {} } = $$props; | ||
let { openGraph = Object.assign(Object.assign({ title, description }, url ? { url } : {}), { locale: "en_US" }) } = $$props; | ||
let { openGraph = { | ||
title, | ||
description, | ||
...url ? { url } : {}, | ||
locale: "en_US" | ||
} } = $$props; | ||
let { robots = "index,follow" } = $$props; | ||
@@ -906,20 +881,19 @@ const jsonLd = content => `<${"script"} type="application/ld+json">${JSON.stringify(content)}</${"script"}>`; | ||
if (!!image && typeof image === "string") { | ||
$$invalidate(1, openGraph = Object.assign({ image }, openGraph)); | ||
$$invalidate(0, twitter = Object.assign({ image }, twitter)); | ||
$$invalidate(1, openGraph = { image, ...openGraph }); | ||
$$invalidate(0, twitter = { image, ...twitter }); | ||
} | ||
if (typeof image === "object") { | ||
$$invalidate(1, openGraph = Object.assign( | ||
{ | ||
image: image.url, | ||
"image:width": image.width, | ||
"image:height": image.height, | ||
"image:alt": image.alt || title | ||
}, | ||
openGraph | ||
)); | ||
$$invalidate(1, openGraph = { | ||
image: image.url, | ||
"image:width": image.width, | ||
"image:height": image.height, | ||
"image:alt": image.alt || title, | ||
...openGraph | ||
}); | ||
$$invalidate(0, twitter = { | ||
image: image.url, | ||
"image:alt": image.alt || title | ||
"image:alt": image.alt || title, | ||
}); | ||
@@ -926,0 +900,0 @@ } |
{ | ||
"name": "svelte-meta", | ||
"description": "Easily generate SEO metadata for Svelte", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"svelte": "./Meta.svelte", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"svelte": "./src/index.js", | ||
"types": "./types/index.d.ts", | ||
"scripts": { | ||
"develop": "rollup -cw", | ||
"build": "rollup -c", | ||
@@ -21,5 +23,5 @@ "prepublishOnly": "npm run build" | ||
"files": [ | ||
"*.ts", | ||
"*.svelte", | ||
"dist" | ||
"src", | ||
"dist", | ||
"types" | ||
], | ||
@@ -34,3 +36,3 @@ "repository": { | ||
"peerDependencies": { | ||
"svelte": "^3.0.0" | ||
"svelte": "^3.31.0" | ||
}, | ||
@@ -37,0 +39,0 @@ "devDependencies": { |
@@ -53,13 +53,13 @@ # Svelte Meta | ||
| Property | Type | Metadata Set | | ||
| ------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | | ||
| `title` | `string` | `<title>`, `title`, `og:title` | | ||
| `description` | `string` | `description`, `og:description` | | ||
| `image` | `string | { url: string; width: number; height: number; alt: string}` | `og:image` | | ||
| `url` | `string` | `canonical`, `og:url` | | ||
| `logoUrl` | `string` | `JSON-LD` | | ||
| `searchUrl` | `string` | `JSON-LD` | | ||
| `sitemapUrl` | `string` | `sitemap` | | ||
| `twitter` | `{ title: string; description: string; card: string, site: string, creator: string }` | `twitter:` | | ||
| `openGraph` | `{ type: string; imageWidth: number; imageHeight: number; imageAlt: string; locale: string; site_name: string }` | `og:` | | ||
| Property | Type | Metadata Set | | ||
| ------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | | ||
| `title` | `string` | `<title>`, `title`, `og:title` | | ||
| `description` | `string` | `description`, `og:description` | | ||
| `image` | `string` | `{ url: string; width: number; height: number; alt: string}`, `og:image` | | ||
| `url` | `string` | `canonical`, `og:url` | | ||
| `logoUrl` | `string` | `JSON-LD` | | ||
| `searchUrl` | `string` | `JSON-LD` | | ||
| `sitemapUrl` | `string` | `sitemap` | | ||
| `twitter` | `{ title: string; description: string; card: string, site: string, creator: string }` | `twitter:` | | ||
| `openGraph` | `{ type: string; imageWidth: number; imageHeight: number; imageAlt: string; locale: string; site_name: string }` | `og:` | | ||
@@ -70,1 +70,3 @@ ### Notes | ||
- `searchUrl` must include a query param with the name `search_term_string` e.g. `https://google.com/search?q={search_term_string}` | ||
- For an overview of `twitter` properties, visit [the Twitter Developer docs](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup) | ||
- For an overview of `openGraph` properties, visit [the OpenGraph website](https://ogp.me/) |
Sorry, the diff of this file is not supported yet
60690
9
1756
70