io-sanita-theme 2.4.2 → 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 CHANGED
@@ -1,5 +1,18 @@
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
+
9
+ ## [2.4.3](https://github.com/RedTurtle/io-sanita-theme/compare/2.4.2...2.4.3) (2025-03-04)
10
+
11
+ ### Bug Fixes
12
+
13
+ * a11y ([431f2c8](https://github.com/RedTurtle/io-sanita-theme/commit/431f2c892ae17646f4ffb607b8405049fcd345b9))
14
+ * locales ([fb213b7](https://github.com/RedTurtle/io-sanita-theme/commit/fb213b78a7e976082db2cf39b0c7eb7488dc7eae))
15
+
3
16
  ## [2.4.2](https://github.com/RedTurtle/io-sanita-theme/compare/2.4.1...2.4.2) (2025-03-04)
4
17
 
5
18
  ### Bug Fixes
package/RELEASE.md CHANGED
@@ -41,6 +41,18 @@
41
41
  - ...
42
42
  -->
43
43
 
44
+ ## Versione 2.5.0 (05/03/2025)
45
+
46
+ ### Novità
47
+
48
+ - implementato lo Schema.org per la homepage del sito
49
+
50
+ ## Versione 2.4.2 (04/03/2025)
51
+
52
+ ### Fix
53
+
54
+ - sistemato lo scroll del menu laterale nelle viste dei content-type
55
+
44
56
  ## Versione 2.3.3 (26/02/2025)
45
57
 
46
58
  ### Fix
@@ -3363,6 +3363,11 @@ msgstr ""
3363
3363
  msgid "sideMenuNavigation"
3364
3364
  msgstr ""
3365
3365
 
3366
+ #. Default: "Avanzamento della navigazione"
3367
+ #: components/View/commons/SideMenu/SideMenu
3368
+ msgid "sideMenuNavigation_progressBar"
3369
+ msgstr ""
3370
+
3366
3371
  #. Default: "Compatto"
3367
3372
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3368
3373
  msgid "simplecard_listing_appearance_compact"
@@ -3358,6 +3358,11 @@ msgstr "Page content index"
3358
3358
  msgid "sideMenuNavigation"
3359
3359
  msgstr "Page content navigation"
3360
3360
 
3361
+ #. Default: "Avanzamento della navigazione"
3362
+ #: components/View/commons/SideMenu/SideMenu
3363
+ msgid "sideMenuNavigation_progressBar"
3364
+ msgstr "Navigation progress"
3365
+
3361
3366
  #. Default: "Compatto"
3362
3367
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3363
3368
  msgid "simplecard_listing_appearance_compact"
@@ -3365,6 +3365,11 @@ msgstr ""
3365
3365
  msgid "sideMenuNavigation"
3366
3366
  msgstr ""
3367
3367
 
3368
+ #. Default: "Avanzamento della navigazione"
3369
+ #: components/View/commons/SideMenu/SideMenu
3370
+ msgid "sideMenuNavigation_progressBar"
3371
+ msgstr ""
3372
+
3368
3373
  #. Default: "Compatto"
3369
3374
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3370
3375
  msgid "simplecard_listing_appearance_compact"
@@ -3365,6 +3365,11 @@ msgstr ""
3365
3365
  msgid "sideMenuNavigation"
3366
3366
  msgstr ""
3367
3367
 
3368
+ #. Default: "Avanzamento della navigazione"
3369
+ #: components/View/commons/SideMenu/SideMenu
3370
+ msgid "sideMenuNavigation_progressBar"
3371
+ msgstr ""
3372
+
3368
3373
  #. Default: "Compatto"
3369
3374
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3370
3375
  msgid "simplecard_listing_appearance_compact"
@@ -3358,6 +3358,11 @@ msgstr ""
3358
3358
  msgid "sideMenuNavigation"
3359
3359
  msgstr ""
3360
3360
 
3361
+ #. Default: "Avanzamento della navigazione"
3362
+ #: components/View/commons/SideMenu/SideMenu
3363
+ msgid "sideMenuNavigation_progressBar"
3364
+ msgstr ""
3365
+
3361
3366
  #. Default: "Compatto"
3362
3367
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3363
3368
  msgid "simplecard_listing_appearance_compact"
package/locales/volto.pot CHANGED
@@ -1,7 +1,7 @@
1
1
  msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Plone\n"
4
- "POT-Creation-Date: 2025-03-03T14:55:08.885Z\n"
4
+ "POT-Creation-Date: 2025-03-04T14:56:52.091Z\n"
5
5
  "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
6
  "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
7
  "Content-Type: text/plain; charset=utf-8\n"
@@ -3360,6 +3360,11 @@ msgstr ""
3360
3360
  msgid "sideMenuNavigation"
3361
3361
  msgstr ""
3362
3362
 
3363
+ #. Default: "Avanzamento della navigazione"
3364
+ #: components/View/commons/SideMenu/SideMenu
3365
+ msgid "sideMenuNavigation_progressBar"
3366
+ msgstr ""
3367
+
3363
3368
  #. Default: "Compatto"
3364
3369
  #: config/blocks/listing/ListingOptions/simpleCardTemplate
3365
3370
  msgid "simplecard_listing_appearance_compact"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "io-sanita-theme",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "io-sanita-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
@@ -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
  </>
@@ -32,7 +32,6 @@ const Body = ({ data, id, isEditMode }) => {
32
32
  }
33
33
  }, [searchableText]);
34
34
 
35
- console.log(data.quick_links);
36
35
  return (
37
36
  <div
38
37
  className={cx(
@@ -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;
@@ -14,16 +14,16 @@ import {
14
14
  const RenderItem = ({ item }) => {
15
15
  switch (item['@type']) {
16
16
  case 'News Item':
17
- return <CardImage item={item} />;
17
+ return <CardImage item={item} titleTag="h3" />;
18
18
  break;
19
19
  case 'Struttura':
20
- return <CardPlace item={item} />;
20
+ return <CardPlace item={item} titleTag="h3" />;
21
21
  break;
22
22
  case 'Persona':
23
- return <CardPersona item={item} />;
23
+ return <CardPersona item={item} titleTag="h3" />;
24
24
  break;
25
25
  default:
26
- return <CardSimple item={item} />;
26
+ return <CardSimple item={item} titleTag="h3" />;
27
27
  }
28
28
  };
29
29
 
@@ -30,6 +30,10 @@ const messages = defineMessages({
30
30
  id: 'sideMenuNavigation',
31
31
  defaultMessage: 'Navigazione della pagina',
32
32
  },
33
+ progressBar: {
34
+ id: 'sideMenuNavigation_progressBar',
35
+ defaultMessage: 'Avanzamento della navigazione',
36
+ },
33
37
  });
34
38
 
35
39
  const extractHeaders = (elements, intl) => {
@@ -82,9 +86,10 @@ const SideMenu = ({ data, content_uid }) => {
82
86
  setIsClient(true);
83
87
  }, []);
84
88
 
85
- const activeItemTitle = headers.find(
86
- (item) => item.id === activeSection,
87
- )?.title;
89
+ const activeItemTitle =
90
+ headers.find((item) => item.id === activeSection)?.title ??
91
+ headers?.[0]?.title ??
92
+ intl.formatMessage(messages.progressBar);
88
93
 
89
94
  const getMainOffset = () => {
90
95
  return isClient
@@ -202,7 +207,7 @@ const SideMenu = ({ data, content_uid }) => {
202
207
  <Progress
203
208
  value={progressValue > 0 ? 100 * progressValue : 0}
204
209
  role="progressbar"
205
- aria-labelledby={activeItemTitle}
210
+ aria-label={activeItemTitle}
206
211
  />
207
212
 
208
213
  <AccordionBody active={isNavOpen} id="side-menu-body">
@@ -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
+ };
@@ -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';