sfc-utils 1.4.26 → 1.4.27

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.
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import { Helmet } from 'react-helmet'
4
4
  import { appCheck, getBrands2 } from "../../index"
5
5
 
6
- const LayoutHelmet = ({ meta, url_add, noindex = false }) => {
6
+ const LayoutHelmet = ({ meta, url_add, noindex=false, schemaOverride={} }) => {
7
7
  let {
8
8
  EMBEDDED,
9
9
  MAIN_DOMAIN,
@@ -62,6 +62,35 @@ const LayoutHelmet = ({ meta, url_add, noindex = false }) => {
62
62
  favHref = "https://files.sfchronicle.com/devhub-logos/DHlogos-sm.png"
63
63
  }
64
64
 
65
+ // Set the default schema that will be used as a fallback
66
+ let schemaContent = `{
67
+ "@context": "http://schema.org",
68
+ "@type": "${schemaOverride.type || "NewsArticle"}",
69
+ "mainEntityOfPage": {
70
+ "@type": "WebPage",
71
+ "@id": "${MAIN_DOMAIN}/${SUBFOLDER}${OPT_SLASH}${SLUG}/${url_add}"
72
+ },
73
+ "headline": "${TITLE}",
74
+ "image": {
75
+ "@type": "ImageObject",
76
+ "url": "${IMAGE}"
77
+ },
78
+ "datePublished": "${ISO_PUBDATE}",
79
+ "dateModified": "${ISO_MODDATE}",
80
+ "author": ${JSON.stringify(authorObj)},
81
+ "publisher": {
82
+ "@type": "Organization",
83
+ "name": "${thisBrand.attributes.siteName}",
84
+ "logo": {
85
+ "@type": "ImageObject",
86
+ "url": "/apple-touch-icon.png",
87
+ "width": "180",
88
+ "height": "180"
89
+ }
90
+ },
91
+ "description": "${DESCRIPTION}"
92
+ }`
93
+
65
94
  return (
66
95
  <Helmet>
67
96
  <title>{TITLE}</title>
@@ -97,33 +126,8 @@ const LayoutHelmet = ({ meta, url_add, noindex = false }) => {
97
126
  <meta property="og:image" content={IMAGE} />
98
127
  <meta property="og:description" content={DESCRIPTION} />
99
128
 
100
- <script data-schema="NewsArticle" type="application/ld+json">{`{
101
- "@context": "http://schema.org",
102
- "@type": "NewsArticle",
103
- "mainEntityOfPage": {
104
- "@type": "WebPage",
105
- "@id": "${MAIN_DOMAIN}/${SUBFOLDER}${OPT_SLASH}${SLUG}/${url_add}"
106
- },
107
- "headline": "${TITLE}",
108
- "image": {
109
- "@type": "ImageObject",
110
- "url": "${IMAGE}"
111
- },
112
- "datePublished": "${ISO_PUBDATE}",
113
- "dateModified": "${ISO_MODDATE}",
114
- "author": ${JSON.stringify(authorObj)},
115
- "publisher": {
116
- "@type": "Organization",
117
- "name": "${thisBrand.attributes.siteName}",
118
- "logo": {
119
- "@type": "ImageObject",
120
- "url": "/apple-touch-icon.png",
121
- "width": "180",
122
- "height": "180"
123
- }
124
- },
125
- "description": "${DESCRIPTION}"
126
- }`}</script>
129
+ <script data-schema={schemaOverride.type || "NewsArticle"} type="application/ld+json">{schemaOverride.content || schemaContent}</script>
130
+
127
131
  </Helmet>
128
132
  )
129
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.26",
3
+ "version": "1.4.27",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",