io-sanita-theme 2.4.3 → 2.5.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 +6 -0
- package/RELEASE.md +6 -0
- package/package.json +1 -1
- package/src/components/AppExtras/GenericAppExtras.jsx +2 -0
- package/src/components/Blocks/QuickSearch/Body.jsx +0 -1
- package/src/components/Home/HomeSchemaOrg.jsx +31 -0
- package/src/helpers/SchemaOrg/SchemaOrg.jsx +50 -0
- package/src/helpers/index.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.5.0](https://github.com/RedTurtle/io-sanita-theme/compare/2.4.3...2.5.0) (2025-03-05)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* SchemaOrg implementation ([8cf0ce8](https://github.com/RedTurtle/io-sanita-theme/commit/8cf0ce8fa754ee4923027bbe60a6cd5712b62d7f))
|
|
8
|
+
|
|
3
9
|
## [2.4.3](https://github.com/RedTurtle/io-sanita-theme/compare/2.4.2...2.4.3) (2025-03-04)
|
|
4
10
|
|
|
5
11
|
### Bug Fixes
|
package/RELEASE.md
CHANGED
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import Helmet from '@plone/volto/helpers/Helmet/Helmet';
|
|
|
6
6
|
import { toPublicURL } from '@plone/volto/helpers/Url/Url';
|
|
7
7
|
import { SubsiteLoader } from 'volto-subsites';
|
|
8
8
|
import config from '@plone/volto/registry';
|
|
9
|
+
import HomeSchemaOrg from 'io-sanita-theme/components/Home/HomeSchemaOrg';
|
|
9
10
|
|
|
10
11
|
const GenericAppExtras = (props) => {
|
|
11
12
|
const location = useLocation();
|
|
@@ -23,6 +24,7 @@ const GenericAppExtras = (props) => {
|
|
|
23
24
|
<link rel="canonical" href={toPublicURL(location.pathname)} />{' '}
|
|
24
25
|
{/** Se impostato un canonlical nei campi SEO della pagina vincerà quello */}
|
|
25
26
|
</Helmet>
|
|
27
|
+
<HomeSchemaOrg {...props} />
|
|
26
28
|
<ScrollToTop />
|
|
27
29
|
<SubsiteLoader pathname={location.pathname} />
|
|
28
30
|
</>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useIntl } from 'react-intl';
|
|
2
|
+
import { toPublicURL } from '@plone/volto/helpers';
|
|
3
|
+
import { SiteProperty } from 'volto-site-settings';
|
|
4
|
+
import { SchemaOrg, getSiteProperty } from 'io-sanita-theme/helpers';
|
|
5
|
+
|
|
6
|
+
const HomeSchemaOrg = ({ content }) => {
|
|
7
|
+
const intl = useIntl();
|
|
8
|
+
let schemaOrg = null;
|
|
9
|
+
if (content['@type'] == 'Plone Site' || content['@type'] == 'LRF') {
|
|
10
|
+
const name = SiteProperty({
|
|
11
|
+
property: 'site_title',
|
|
12
|
+
defaultValue: getSiteProperty('siteTitle', intl.locale),
|
|
13
|
+
getValue: true,
|
|
14
|
+
});
|
|
15
|
+
const description = SiteProperty({
|
|
16
|
+
property: 'site_subtitle',
|
|
17
|
+
defaultValue: getSiteProperty('siteSubtitle', intl.locale),
|
|
18
|
+
getValue: true,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
schemaOrg = {
|
|
22
|
+
'@type': 'MedicalOrganization',
|
|
23
|
+
name: name,
|
|
24
|
+
description: description,
|
|
25
|
+
url: toPublicURL(content['@id']),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return schemaOrg ? <SchemaOrg schema={schemaOrg} /> : <></>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default HomeSchemaOrg;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useIntl } from 'react-intl';
|
|
2
|
+
import { Helmet } from '@plone/volto/helpers';
|
|
3
|
+
import { SiteProperty } from 'volto-site-settings';
|
|
4
|
+
import { getSiteProperty } from 'io-sanita-theme/helpers';
|
|
5
|
+
|
|
6
|
+
const fieldDataToPlainText = (field) => {
|
|
7
|
+
return field.blocks_layout.items.reduce((accumulator, item, index) => {
|
|
8
|
+
if (field.blocks[item]['@type'] === 'text') {
|
|
9
|
+
if (index > 0) accumulator += ' ';
|
|
10
|
+
accumulator += field.blocks[item].text?.blocks[0].text ?? '';
|
|
11
|
+
}
|
|
12
|
+
if (field.blocks[item]['@type'] === 'slate') {
|
|
13
|
+
if (index > 0) accumulator += ' ';
|
|
14
|
+
accumulator += field.blocks[item].plaintext ?? '';
|
|
15
|
+
}
|
|
16
|
+
return accumulator;
|
|
17
|
+
}, '');
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const getSiteTitle = () => {
|
|
21
|
+
const intl = useIntl();
|
|
22
|
+
let siteTitle = SiteProperty({
|
|
23
|
+
property: 'site_title',
|
|
24
|
+
getValue: true,
|
|
25
|
+
defaultTitle: getSiteProperty('siteTitle', intl.locale),
|
|
26
|
+
});
|
|
27
|
+
return siteTitle?.replaceAll('\\n', ' - ') ?? '';
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const SchemaOrg = ({ content, schema = {} }) => {
|
|
31
|
+
let schemaOrg = {
|
|
32
|
+
'@context': 'https://schema.org',
|
|
33
|
+
name: content.title,
|
|
34
|
+
...schema,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Helmet>
|
|
39
|
+
<script type="application/ld+json" data-element="metatag">
|
|
40
|
+
{JSON.stringify(schemaOrg)}
|
|
41
|
+
</script>
|
|
42
|
+
</Helmet>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default SchemaOrg;
|
|
47
|
+
export const SchemaOrgUtils = {
|
|
48
|
+
getSiteTitle,
|
|
49
|
+
fieldDataToPlainText,
|
|
50
|
+
};
|
package/src/helpers/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SchemaOrgUtils } from './SchemaOrg/SchemaOrg';
|
|
2
|
+
|
|
1
3
|
export { getSiteProperty } from 'io-sanita-theme/helpers/config';
|
|
2
4
|
export {
|
|
3
5
|
viewDate,
|
|
@@ -74,3 +76,8 @@ export { getItemIcon, hasGeolocation } from 'io-sanita-theme/helpers/Item/item';
|
|
|
74
76
|
|
|
75
77
|
//registry
|
|
76
78
|
export { getComponentWithFallback } from 'io-sanita-theme/helpers/registry';
|
|
79
|
+
|
|
80
|
+
//schemaOrg
|
|
81
|
+
export SchemaOrg, {
|
|
82
|
+
SchemaOrgUtils,
|
|
83
|
+
} from 'io-sanita-theme/helpers/SchemaOrg/SchemaOrg';
|