@treely/strapi-slices 7.13.1 → 7.14.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/dist/components/SEOTags/SEOTags.d.ts +2 -3
- package/dist/strapi-slices.cjs.development.js +10 -30
- package/dist/strapi-slices.cjs.development.js.map +1 -1
- package/dist/strapi-slices.cjs.production.min.js +1 -1
- package/dist/strapi-slices.cjs.production.min.js.map +1 -1
- package/dist/strapi-slices.esm.js +10 -30
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SEOTags/SEOTags.tsx +19 -36
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Article, BlogPosting, Brand, BreadcrumbList, Event, FAQPage, HowTo, LocalBusiness, Offer, Organization, Person, Product, Service, WebPage, WithContext } from 'schema-dts';
|
|
3
|
-
type SupportedSchemaType = Article | BlogPosting | Brand | BreadcrumbList | Event | FAQPage | HowTo | LocalBusiness | Offer | Organization | Person | Product | Service | WebPage;
|
|
2
|
+
import { Article, BlogPosting, Brand, BreadcrumbList, Event, FAQPage, HowTo, LocalBusiness, Offer, Organization, Person, Product, QAPage, Service, SoftwareApplication, WebPage, WithContext } from 'schema-dts';
|
|
3
|
+
type SupportedSchemaType = Article | BlogPosting | Brand | BreadcrumbList | Event | FAQPage | HowTo | LocalBusiness | Offer | Organization | Person | Product | QAPage | Product | Service | SoftwareApplication | WebPage;
|
|
4
4
|
interface SEOTagsProps {
|
|
5
5
|
title: string;
|
|
6
6
|
description: string;
|
|
@@ -16,7 +16,6 @@ interface SEOTagsProps {
|
|
|
16
16
|
* This can be a single schema object or an array of schema objects.
|
|
17
17
|
* Each object must include an `@context` property set to "https://schema.org"
|
|
18
18
|
* and an `@type` property indicating the type of schema (e.g., Article, Product).
|
|
19
|
-
* The schema falls back to the default schema if it is invalid.
|
|
20
19
|
*/
|
|
21
20
|
schemaMarkup?: WithContext<SupportedSchemaType> | WithContext<SupportedSchemaType>[];
|
|
22
21
|
}
|
|
@@ -1000,6 +1000,10 @@ var getSchemaIdentifier = function getSchemaIdentifier(schema) {
|
|
|
1000
1000
|
return "offer-" + ((_offer$price = offer.price) != null ? _offer$price : 'unknown-price');
|
|
1001
1001
|
case 'WebPage':
|
|
1002
1002
|
return getSchemaProperty(schema, 'name') || 'untitled-page';
|
|
1003
|
+
case 'QAPage':
|
|
1004
|
+
return getSchemaProperty(schema, 'name') || 'untitled-qa';
|
|
1005
|
+
case 'SoftwareApplication':
|
|
1006
|
+
return getSchemaProperty(schema, 'name') || 'untitled-software';
|
|
1003
1007
|
default:
|
|
1004
1008
|
return 'unknown-schema';
|
|
1005
1009
|
}
|
|
@@ -1012,29 +1016,6 @@ var validateSchema = function validateSchema(schema) {
|
|
|
1012
1016
|
}
|
|
1013
1017
|
return schema['@context'] === 'https://schema.org' && '@type' in schema;
|
|
1014
1018
|
};
|
|
1015
|
-
var DEFAULT_SCHEMA = {
|
|
1016
|
-
'@context': 'https://schema.org',
|
|
1017
|
-
'@type': 'Organization',
|
|
1018
|
-
name: 'Tree.ly',
|
|
1019
|
-
url: 'https://tree.ly',
|
|
1020
|
-
logo: 'https://cdn.tree.ly/logo.png',
|
|
1021
|
-
address: {
|
|
1022
|
-
'@type': 'PostalAddress',
|
|
1023
|
-
streetAddress: 'Littengasse 2b/c',
|
|
1024
|
-
addressLocality: 'Dornbirn',
|
|
1025
|
-
postalCode: '6850',
|
|
1026
|
-
addressRegion: 'Vorarlberg',
|
|
1027
|
-
addressCountry: 'AT'
|
|
1028
|
-
},
|
|
1029
|
-
contactPoint: {
|
|
1030
|
-
'@type': 'ContactPoint',
|
|
1031
|
-
telephone: '+43-5572-432015',
|
|
1032
|
-
contactType: 'Customer Service',
|
|
1033
|
-
areaServed: 'AT',
|
|
1034
|
-
availableLanguage: ['English', 'German']
|
|
1035
|
-
},
|
|
1036
|
-
sameAs: ['https://www.linkedin.com/company/tree-ly', 'https://www.facebook.com/treely', 'https://www.instagram.com/treely']
|
|
1037
|
-
};
|
|
1038
1019
|
var SEOTags = function SEOTags(_ref) {
|
|
1039
1020
|
var _shareImage$url, _shareImage$alt;
|
|
1040
1021
|
var title = _ref.title,
|
|
@@ -1049,18 +1030,17 @@ var SEOTags = function SEOTags(_ref) {
|
|
|
1049
1030
|
schemaMarkup = _ref.schemaMarkup;
|
|
1050
1031
|
var shareImageUrl = (_shareImage$url = shareImage == null ? void 0 : shareImage.url) != null ? _shareImage$url : DEFAULT_SHARE_IMAGE;
|
|
1051
1032
|
var shareImageAlt = (_shareImage$alt = shareImage == null ? void 0 : shareImage.alt) != null ? _shareImage$alt : DEFAULT_SHARE_ALT;
|
|
1052
|
-
var schemas = schemaMarkup
|
|
1053
|
-
var isValidSchema = validateSchema(
|
|
1033
|
+
var schemas = schemaMarkup;
|
|
1034
|
+
var isValidSchema = schemaMarkup ? validateSchema(schemaMarkup) : false;
|
|
1054
1035
|
if (schemaMarkup && !isValidSchema) {
|
|
1055
|
-
console.warn('Invalid schema markup provided to SEOTags component.
|
|
1056
|
-
schemas =
|
|
1057
|
-
isValidSchema =
|
|
1036
|
+
console.warn('Invalid schema markup provided to SEOTags component. Schema markup will not be rendered.', schemaMarkup);
|
|
1037
|
+
schemas = undefined;
|
|
1038
|
+
isValidSchema = false;
|
|
1058
1039
|
}
|
|
1059
|
-
var schemaArray = Array.isArray(schemas) ? schemas : [schemas];
|
|
1040
|
+
var schemaArray = schemas ? Array.isArray(schemas) ? schemas : [schemas] : [];
|
|
1060
1041
|
var getSchemaKey = function getSchemaKey(schema, index) {
|
|
1061
1042
|
var type = schema['@type'];
|
|
1062
1043
|
var identifier = getSchemaIdentifier(schema);
|
|
1063
|
-
// Add index to ensure uniqueness, especially for fallback identifiers
|
|
1064
1044
|
return type + "-" + identifier + "-" + index;
|
|
1065
1045
|
};
|
|
1066
1046
|
return React__default.default.createElement(Head__default.default, null, React__default.default.createElement("title", null, title + " - " + metaTitleSuffix), React__default.default.createElement("meta", {
|