@bkwld/json-ld-formatters
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -9,2 +9,3 @@ function $parcel$export(e, n, v, s) { | ||
$parcel$export(module.exports, "makeJsonLdSearchTag", () => $5481b6a2b1eb1639$export$9fa68bface6198c1); | ||
$parcel$export(module.exports, "makeJsonLdBreadcrumbsTag", () => $5481b6a2b1eb1639$export$38f0a148ac0f1762); | ||
function $22a09b144049ac17$export$2e2bcd8739ae039({ type: type , title: title , image: image , publishedAt: publishedAt , updatedAt: updatedAt , author: author } = { | ||
@@ -110,2 +111,33 @@ }) { | ||
// Create a JSON LD breadcrumb tag | ||
// https://developers.google.com/search/docs/advanced/structured-data/breadcrumb | ||
// Set defaults and cast vars | ||
var $4699710f68157ac2$var$getItem, $4699710f68157ac2$var$url; | ||
$4699710f68157ac2$var$url = $4699710f68157ac2$var$url || process.env.URL; | ||
function $4699710f68157ac2$export$2e2bcd8739ae039(breadcrumbsList = []) { | ||
var breadcrumbs; | ||
// Make the breadcrumbs | ||
breadcrumbs = breadcrumbsList.map(function(data, index, array) { | ||
return { | ||
'@type': 'ListItem', | ||
position: index + 1, | ||
name: data.name, | ||
item: $4699710f68157ac2$var$getItem(data) | ||
}; | ||
}); | ||
return { | ||
// Make the JSON LD | ||
"@context": "https://schema.org", | ||
"@type": "BreadcrumbList", | ||
"itemListElement": breadcrumbs | ||
}; | ||
} | ||
// Helper to get breadcrumb item | ||
$4699710f68157ac2$var$getItem = function(breadcrumb) { | ||
if (!(breadcrumb.url || breadcrumb.path)) return; | ||
if (breadcrumb.url) return breadcrumb.url; | ||
else return $4699710f68157ac2$var$url + breadcrumb.path; | ||
}; | ||
/* | ||
@@ -126,2 +158,5 @@ Render the script tag that renders json-ld | ||
}; | ||
var $5481b6a2b1eb1639$export$38f0a148ac0f1762 = function(props) { | ||
return $5481b6a2b1eb1639$var$makeTag($4699710f68157ac2$export$2e2bcd8739ae039(props)); | ||
}; | ||
// Wrap the json ld data in the stucture needed by vue meta | ||
@@ -128,0 +163,0 @@ $5481b6a2b1eb1639$var$makeTag = function(data) { |
@@ -101,2 +101,33 @@ function $84ce8bef1b4ff9bb$export$2e2bcd8739ae039({ type: type , title: title , image: image , publishedAt: publishedAt , updatedAt: updatedAt , author: author } = { | ||
// Create a JSON LD breadcrumb tag | ||
// https://developers.google.com/search/docs/advanced/structured-data/breadcrumb | ||
// Set defaults and cast vars | ||
var $a91c8d8b967f5f70$var$getItem, $a91c8d8b967f5f70$var$url; | ||
$a91c8d8b967f5f70$var$url = $a91c8d8b967f5f70$var$url || process.env.URL; | ||
function $a91c8d8b967f5f70$export$2e2bcd8739ae039(breadcrumbsList = []) { | ||
var breadcrumbs; | ||
// Make the breadcrumbs | ||
breadcrumbs = breadcrumbsList.map(function(data, index, array) { | ||
return { | ||
'@type': 'ListItem', | ||
position: index + 1, | ||
name: data.name, | ||
item: $a91c8d8b967f5f70$var$getItem(data) | ||
}; | ||
}); | ||
return { | ||
// Make the JSON LD | ||
"@context": "https://schema.org", | ||
"@type": "BreadcrumbList", | ||
"itemListElement": breadcrumbs | ||
}; | ||
} | ||
// Helper to get breadcrumb item | ||
$a91c8d8b967f5f70$var$getItem = function(breadcrumb) { | ||
if (!(breadcrumb.url || breadcrumb.path)) return; | ||
if (breadcrumb.url) return breadcrumb.url; | ||
else return $a91c8d8b967f5f70$var$url + breadcrumb.path; | ||
}; | ||
/* | ||
@@ -117,2 +148,5 @@ Render the script tag that renders json-ld | ||
}; | ||
var $a56e88318c4367d9$export$38f0a148ac0f1762 = function(props) { | ||
return $a56e88318c4367d9$var$makeTag($a91c8d8b967f5f70$export$2e2bcd8739ae039(props)); | ||
}; | ||
// Wrap the json ld data in the stucture needed by vue meta | ||
@@ -131,3 +165,3 @@ $a56e88318c4367d9$var$makeTag = function(data) { | ||
export {$a56e88318c4367d9$export$8edec034e5425182 as makeJsonLdArticleTag, $a56e88318c4367d9$export$66bd74c8c00bc085 as makeJsonLdOrganizationTag, $a56e88318c4367d9$export$ed912fd0e21f068e as makeJsonLdProductTag, $a56e88318c4367d9$export$9fa68bface6198c1 as makeJsonLdSearchTag}; | ||
export {$a56e88318c4367d9$export$8edec034e5425182 as makeJsonLdArticleTag, $a56e88318c4367d9$export$66bd74c8c00bc085 as makeJsonLdOrganizationTag, $a56e88318c4367d9$export$ed912fd0e21f068e as makeJsonLdProductTag, $a56e88318c4367d9$export$9fa68bface6198c1 as makeJsonLdSearchTag, $a56e88318c4367d9$export$38f0a148ac0f1762 as makeJsonLdBreadcrumbsTag}; | ||
//# sourceMappingURL=module.js.map |
{ | ||
"name": "@bkwld/json-ld-formatters", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "A library of helper functions for creating common JSON LD schemas.", | ||
@@ -5,0 +5,0 @@ "author": "Bukwild", |
@@ -53,4 +53,5 @@ # json-ld-formatters | ||
- [article](./formatters/article.coffee) - `makeJsonLdArticleTag` | ||
- [breadcrumbs](./formatters/breadcrumbs.coffee) - `makeJsonLdBreadcrumbsTag` | ||
- [organization](./formatters/organization.coffee) - `makeJsonLdOrganizationTag` | ||
- [product](./formatters/product.coffee) `makeJsonLdProductTag` | ||
- [search](./formatters/search.coffee) - `makeJsonLdSearchTag` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
37121
13
312
57
0