sfc-utils 1.4.76 → 1.4.77

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/brands3.js ADDED
@@ -0,0 +1,224 @@
1
+
2
+ // Set brand object to override CSS based on this market's styles
3
+ let getBrands3 = function(market){
4
+ // We can add any Hearst global overrides here:
5
+ let defaultObj = {
6
+ styles: {
7
+ "@alert-red": "#d20000",
8
+ // Defaults
9
+ "@display": '"Archivo", Arial, sans-serif',
10
+ "@body": '"Mulish", Verdana, sans-serif',
11
+ "@secondary": '"Rubik", Arial, sans-serif',
12
+ //backwards compatible
13
+ "@hed": '"Archivo", Arial, sans-serif',
14
+ "@hed-alt": '"Archivo", Arial, sans-serif',
15
+ "@serif": '"Mulish", Verdana, sans-serif',
16
+ "@sans": '"Rubik", Arial, sans-serif',
17
+ "@sans-alt": '"Rubik", Arial, sans-serif',
18
+
19
+ // Icons
20
+ "@sub-icon": `url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="white"><path d="M160 416H96c-17.67 0-32-14.33-32-32V128c0-17.67 14.33-32 32-32h64c17.67 0 32-14.33 32-32S177.7 32 160 32H96C42.98 32 0 74.98 0 128v256c0 53.02 42.98 96 96 96h64c17.67 0 32-14.33 32-32S177.7 416 160 416zM502.6 233.4l-128-128c-12.51-12.51-32.76-12.49-45.25 0c-12.5 12.5-12.5 32.75 0 45.25L402.8 224H192C174.3 224 160 238.3 160 256s14.31 32 32 32h210.8l-73.38 73.38c-12.5 12.5-12.5 32.75 0 45.25s32.75 12.5 45.25 0l128-128C515.1 266.1 515.1 245.9 502.6 233.4z"/></svg>')`,
21
+ },
22
+ attributes: {
23
+ "subscribeLink": "https://www.hearst.com/newspapers?projects=true"
24
+ }
25
+ }
26
+
27
+ // Handle market-specific styles here:
28
+ let marketObj = {
29
+ /* San Franicsco Chronicle */
30
+ SFC: {
31
+ styles: {
32
+ "@brand": "#26A0A5",
33
+ "@brand-secondary": "#FFBC30",
34
+ "@display": '"Tiempos Headline", "Baskerville", Georgia, serif',
35
+ "@body": '"Tiempos", "Baskerville", Georgia, serif',
36
+ "@secondary": '"National", Arial, Helvetica, sans-serif',
37
+ //backwards compatible
38
+ "@hed": '"Tiempos Headline", "Baskerville", Georgia, serif',
39
+ "@hed-alt": '"Tiempos Headline", "Baskerville", Georgia, serif',
40
+ "@serif": '"Tiempos", "Baskerville", Georgia, serif',
41
+ "@sans": '"National", Arial, Helvetica, sans-serif',
42
+ "@sans-alt": '"National", Arial, Helvetica, sans-serif'
43
+ },
44
+ attributes: {
45
+ "marketPrefix": "sf",
46
+ "siteName": "The San Francisco Chronicle",
47
+ "twitter": "sfchronicle",
48
+ "gaAccount": "UA-1616916-26",
49
+ "subscribeLink": "https://www.sfchronicle.com/subproject",
50
+ "sailCustomer": "fca2a0390286f0e53120a668534d9529",
51
+ "sailSiteName": "san-francisco-chronicle",
52
+ "siteId": 35,
53
+ }
54
+ },
55
+
56
+ /* Houston Chronicle */
57
+ Houston: {
58
+ styles: {
59
+ "@brand": "#CB0024",
60
+ "@brand-secondary": "#1C2146"
61
+ },
62
+ attributes: {
63
+ "marketPrefix": "hc",
64
+ "siteName": "The Houston Chronicle",
65
+ "twitter": "HoustonChron",
66
+ "invert": true,
67
+ "gaAccount": "UA-1616916-24",
68
+ "subscribeLink": "https://www.houstonchronicle.com/subproject",
69
+ "sailCustomer": "48e30b5083cf6bf47c519651453c9e8a",
70
+ "sailSiteName": "houston-chronicle",
71
+ "siteId": 33
72
+ }
73
+ },
74
+
75
+ /* Albany Times Union */
76
+ Albany: {
77
+ styles: {
78
+ "@brand": "#006FBA",
79
+ "@brand-secondary": "#E5A72C"
80
+ },
81
+ attributes: {
82
+ "marketPrefix": "tu",
83
+ "siteName": "Times Union",
84
+ "twitter": "timesunion",
85
+ "invert": true,
86
+ "gaAccount": "UA-1616916-7",
87
+ "subscribeLink": "https://www.timesunion.com/subproject",
88
+ "sailCustomer": "5bb9eee089bdc2e27cbd265535ad1f90",
89
+ "sailSiteName": "times-union",
90
+ "siteId": 3
91
+ }
92
+ },
93
+
94
+ /* San Antonio Express News */
95
+ SanAntonio: {
96
+ styles: {
97
+ "@brand": "#BA142D",
98
+ "@brand-secondary": "#189196"
99
+ },
100
+ attributes: {
101
+ "marketPrefix": "sa",
102
+ "siteName": "Express-News",
103
+ "twitter": "ExpressNews",
104
+ "invert": true,
105
+ "gaAccount": "UA-1616916-27",
106
+ "subscribeLink": "https://www.expressnews.com/subproject",
107
+ "sailCustomer": "aec52c4681ed63b5beab139a2584f0d4",
108
+ "sailSiteName": "san-antonio-express-news",
109
+ "siteId": 36
110
+ }
111
+ },
112
+
113
+ /* Connecticut */
114
+ CT: {
115
+ styles: {
116
+ "@brand": "#1A98FF",
117
+ "@brand-secondary": "#FFBC30"
118
+ },
119
+ attributes: {
120
+ "marketPrefix": "in",
121
+ "siteName": "CTInsider",
122
+ "twitter": "insider_ct",
123
+ "invert": true,
124
+ "gaAccount": "UA-1616916-99",
125
+ "subscribeLink": "https://www.ctinsider.com/subproject",
126
+ "sailCustomer": "9b21160afa226c9f84d27b47c3d52364",
127
+ "sailSiteName": "ct-insider",
128
+ "siteId": 61
129
+ }
130
+ },
131
+
132
+ /* Communities */
133
+ Texcom: {
134
+ styles: {
135
+ "@brand": "#900900",
136
+ "@brand-secondary": "#189196"
137
+ },
138
+ attributes: {
139
+ "marketPrefix": "texcom/mrt",
140
+ "siteName": "Midland Reporter-Telegram",
141
+ "twitter": "mwtnews",
142
+ "invert": true,
143
+ "gaAccount": "UA-1616916-99",
144
+ "subscribeLink": "/subproject",
145
+ "sailCustomer": "4a181de0b63a131cf27f8ea9485e5e1c",
146
+ "sailSiteName": "midland-reporter-telegram",
147
+ "siteId": 57
148
+ }
149
+ },
150
+ Midcom: {
151
+ styles: {
152
+ "@brand": "#900900",
153
+ "@brand-secondary": "#189196"
154
+ },
155
+ attributes: {
156
+ "marketPrefix": "midcom/mid",
157
+ "siteName": "Midland Daily News",
158
+ "twitter": "MDN",
159
+ "invert": true,
160
+ "gaAccount": "UA-1616916-99",
161
+ "subscribeLink": "/subproject",
162
+ "sailCustomer": "4a181de0b63a131cf27f8ea9485e5e1c",
163
+ "sailSiteName": "midland-daily-news",
164
+ "siteId": 61
165
+ }
166
+ },
167
+ Conroe: {
168
+ styles: {
169
+ "@brand": "#900900",
170
+ "@brand-secondary": "#189196"
171
+ },
172
+ attributes: {
173
+ "marketPrefix": "conroe",
174
+ "siteName": "Conroe Courier",
175
+ "twitter": "ConroeCourier",
176
+ "invert": true,
177
+ "gaAccount": "UA-1616916-99",
178
+ "subscribeLink": "https://www.yourconroenews.com/subproject",
179
+ "sailCustomer": "4a181de0b63a131cf27f8ea9485e5e1c",
180
+ "sailSiteName": "the-courier-of-montgomery-county",
181
+ "siteId": 68
182
+ }
183
+ },
184
+ Seattle: {
185
+ styles: {
186
+ "@brand": "#3F8395",
187
+ "@brand-secondary": "#189196"
188
+ },
189
+ attributes: {
190
+ "marketPrefix": "seattle",
191
+ "siteName": "Seattle PI",
192
+ "twitter": "seattlepi",
193
+ "invert": true,
194
+ "gaAccount": "UA-1616916-99",
195
+ "subscribeLink": "",
196
+ "sailCustomer": "da30899589786517b0c0cead37a48b06",
197
+ "sailSiteName": "seattle-post-intelligencer",
198
+ "siteId": 20
199
+ }
200
+ },
201
+ /* Misc */
202
+ TK: {
203
+ styles: {
204
+ "@brand": "#900900",
205
+ "@brand-secondary": "#189196"
206
+ },
207
+ attributes: {
208
+ "marketPrefix": "tk",
209
+ "siteName": "Hearst Digital News",
210
+ "twitter": "Hearst",
211
+ "invert": true,
212
+ }
213
+ }
214
+ }
215
+
216
+ // Combine global and market styles to return the final object
217
+ let combinedStyles = {
218
+ styles: Object.assign(defaultObj.styles, marketObj[market].styles),
219
+ attributes: Object.assign(defaultObj.attributes, marketObj[market].attributes)
220
+ }
221
+ return combinedStyles
222
+ }
223
+
224
+ module.exports = { getBrands3 }
@@ -1,5 +1,5 @@
1
1
  import { getBlueconic } from "../../blueconic"
2
- import { getBrands2 } from "../../brands2"
2
+ import { getBrands3 } from "../../brands3"
3
3
  import { appCheck, blendHDN } from "../../index"
4
4
 
5
5
  /** Used for resizing the WCM Image */
@@ -51,7 +51,7 @@ function appendLayoutScripts(isEmbedded, isAdRemoved, marketKey) {
51
51
 
52
52
  // Init sailthru
53
53
  if (window && window.Sailthru && marketKey) {
54
- window.Sailthru.init({ customerId: getBrands2(marketKey).attributes.sailCustomer })
54
+ window.Sailthru.init({ customerId: getBrands3(marketKey).attributes.sailCustomer })
55
55
  }
56
56
  }
57
57
  }, 5000)
@@ -59,7 +59,7 @@ function appendLayoutScripts(isEmbedded, isAdRemoved, marketKey) {
59
59
 
60
60
  function formatHDN(isEmbedded, url_add, meta) {
61
61
  const isApp = appCheck();
62
- const thisBrand = getBrands2(meta.PROJECT.MARKET_KEY);
62
+ const thisBrand = getBrands3(meta.PROJECT.MARKET_KEY);
63
63
 
64
64
  // Combine our settings with what Hearst puts on page
65
65
  let stringHDN = ''
@@ -1,9 +1,15 @@
1
- import React from 'react'
1
+ import React from "react";
2
2
 
3
- import { Helmet } from 'react-helmet'
4
- import { appCheck, getBrands2 } from "../../index"
3
+ import { Helmet } from "react-helmet";
4
+ import { appCheck, getBrands2, getBrands3 } from "../../index";
5
5
 
6
- const LayoutHelmet = ({ meta, url_add, noindex=false, schemaOverride={} }) => {
6
+ const LayoutHelmet = ({
7
+ meta,
8
+ url_add,
9
+ noindex = false,
10
+ schemaOverride = {},
11
+ brandsVer = 2,
12
+ }) => {
7
13
  let {
8
14
  EMBEDDED,
9
15
  MAIN_DOMAIN,
@@ -21,69 +27,82 @@ const LayoutHelmet = ({ meta, url_add, noindex=false, schemaOverride={} }) => {
21
27
  MARKET_KEY,
22
28
  CANONICAL_URL,
23
29
  ANALYTICS_CREDIT,
24
- SECTION
30
+ SECTION,
25
31
  },
26
- } = meta
32
+ } = meta;
27
33
 
28
- const isApp = appCheck()
29
- const thisBrand = getBrands2(MARKET_KEY);
30
-
31
- // Get stylesheet id from market key
32
- let styleSheetID
33
- if ((MARKET_KEY === "SFC") || (MARKET_KEY === "Houston") || (MARKET_KEY === "Albany")) {
34
- styleSheetID = MARKET_KEY
35
- }
36
- else {
37
- styleSheetID = "default"
34
+ // Handle style sheet on brands2 vs brands3
35
+ const isApp = appCheck();
36
+ let styleSheetID;
37
+ let thisBrand;
38
+ if (brandsVer === 2) {
39
+ thisBrand = getBrands2(MARKET_KEY);
40
+ if (
41
+ MARKET_KEY === "SFC" ||
42
+ MARKET_KEY === "Houston" ||
43
+ MARKET_KEY === "Albany"
44
+ ) {
45
+ styleSheetID = MARKET_KEY;
46
+ } else {
47
+ styleSheetID = "default";
48
+ }
49
+ } else {
50
+ thisBrand = getBrands3(MARKET_KEY);
51
+ if (MARKET_KEY === "SFC") {
52
+ styleSheetID = "plat-styles/" + MARKET_KEY;
53
+ } else {
54
+ styleSheetID = "plat-styles/default";
55
+ }
38
56
  }
39
57
 
40
58
  // Handle author data
41
- let authorObj = []
42
- let newAuthor = {}
59
+ let authorObj = [];
60
+ let newAuthor = {};
43
61
  try {
44
- if (!ANALYTICS_CREDIT){
62
+ if (!ANALYTICS_CREDIT) {
45
63
  // If we have authors (not analytics credit), use those
46
- AUTHORS.forEach(author => {
64
+ AUTHORS.forEach((author) => {
47
65
  newAuthor = {
48
- '@type': 'Person',
66
+ "@type": "Person",
49
67
  name: author.AUTHOR_NAME,
50
68
  url: author.AUTHOR_PAGE,
51
- }
52
- authorObj.push(newAuthor)
53
- })
69
+ };
70
+ authorObj.push(newAuthor);
71
+ });
54
72
  } else {
55
73
  // If we have analytics credit, use that
56
- const creditList = ANALYTICS_CREDIT.split(",")
57
- creditList.forEach(credit => {
74
+ const creditList = ANALYTICS_CREDIT.split(",");
75
+ creditList.forEach((credit) => {
58
76
  newAuthor = {
59
- '@type': 'Person',
77
+ "@type": "Person",
60
78
  name: credit,
61
- url: MAIN_DOMAIN // Not ideal to not have the actual author page, but we don't have it
62
- }
63
- authorObj.push(newAuthor)
64
- })
79
+ url: MAIN_DOMAIN, // Not ideal to not have the actual author page, but we don't have it
80
+ };
81
+ authorObj.push(newAuthor);
82
+ });
65
83
  }
66
84
  } catch (err) {
67
85
  // If it errored, just set to neutral default
68
86
  authorObj = {
69
- '@type': 'Person',
87
+ "@type": "Person",
70
88
  name: thisBrand.attributes.siteName,
71
89
  url: MAIN_DOMAIN,
72
- }
90
+ };
73
91
  }
74
92
 
75
93
  // Handle special favicon logic
76
- let favHref = "/favicon.ico"
77
- if (MARKET_KEY === "TK"){
78
- favHref = "https://files.sfchronicle.com/devhub-logos/DHlogos-sm.png"
79
- } else if (MARKET_KEY === "Seattle"){
80
- favHref = "https://www.seattlepi.com/sites/seattlepi/apple-touch-icon-196x196.png"
94
+ let favHref = "/favicon.ico";
95
+ if (MARKET_KEY === "TK") {
96
+ favHref = "https://files.sfchronicle.com/devhub-logos/DHlogos-sm.png";
97
+ } else if (MARKET_KEY === "Seattle") {
98
+ favHref =
99
+ "https://www.seattlepi.com/sites/seattlepi/apple-touch-icon-196x196.png";
81
100
  }
82
101
 
83
102
  // Set section with fallback
84
- let articleSection = "Local"
103
+ let articleSection = "Local";
85
104
  if (SECTION) {
86
- articleSection = SECTION
105
+ articleSection = SECTION;
87
106
  }
88
107
 
89
108
  // Set the default schema that will be used as a fallback
@@ -114,21 +133,20 @@ const LayoutHelmet = ({ meta, url_add, noindex=false, schemaOverride={} }) => {
114
133
  },
115
134
  "articleSection": "${articleSection}",
116
135
  "description": "${DESCRIPTION}"
117
- }`
136
+ }`;
118
137
 
119
138
  return (
120
139
  <Helmet>
121
140
  <title>{TITLE}</title>
122
141
  <meta name="description" content={DESCRIPTION} />
142
+ <link rel="shortcut icon" href={favHref} type="image/x-icon" />
143
+ <link rel="canonical" href={`${CANONICAL_URL}/${url_add}`} />
123
144
  <link
124
- rel="shortcut icon"
125
- href={favHref}
126
- type="image/x-icon"
145
+ rel="stylesheet"
146
+ href={`https://files.sfchronicle.com/brand-styles/${styleSheetID}.css`}
127
147
  />
128
- <link rel="canonical" href={`${CANONICAL_URL}/${url_add}`} />
129
- <link rel="stylesheet" href={`https://files.sfchronicle.com/brand-styles/${styleSheetID}.css`} />
130
148
 
131
- {(isApp || EMBEDDED || noindex) ? (
149
+ {isApp || EMBEDDED || noindex ? (
132
150
  <meta name="robots" content="noindex, nofollow" />
133
151
  ) : (
134
152
  <meta name="robots" content="max-image-preview:large" />
@@ -147,14 +165,21 @@ const LayoutHelmet = ({ meta, url_add, noindex=false, schemaOverride={} }) => {
147
165
  <meta property="og:type" content="article" />
148
166
  <meta property="og:title" content={SOCIAL_TITLE} />
149
167
  <meta property="og:site_name" content={thisBrand.attributes.siteName} />
150
- <meta property="og:url" content={`${MAIN_DOMAIN}/${SUBFOLDER}${OPT_SLASH}${SLUG}/${url_add}`} />
168
+ <meta
169
+ property="og:url"
170
+ content={`${MAIN_DOMAIN}/${SUBFOLDER}${OPT_SLASH}${SLUG}/${url_add}`}
171
+ />
151
172
  <meta property="og:image" content={IMAGE} />
152
173
  <meta property="og:description" content={DESCRIPTION} />
153
174
 
154
- <script data-schema={schemaOverride.type || "NewsArticle"} type="application/ld+json">{schemaOverride.content || schemaContent}</script>
155
-
175
+ <script
176
+ data-schema={schemaOverride.type || "NewsArticle"}
177
+ type="application/ld+json"
178
+ >
179
+ {schemaOverride.content || schemaContent}
180
+ </script>
156
181
  </Helmet>
157
- )
158
- }
182
+ );
183
+ };
159
184
 
160
- export default LayoutHelmet
185
+ export default LayoutHelmet;
package/css/nav2.less CHANGED
@@ -1,5 +1,5 @@
1
1
  // TODO: move file into styles
2
- // NOTE: This relies on variables that are updated in brands2.js
2
+ // NOTE: This relies on variables that are updated in brands3.js
3
3
  // Styles for the nav
4
4
  .nav2-container {
5
5
  width: 100%;
@@ -1,5 +1,5 @@
1
1
  // Add SFC utils
2
- const { getBrands2 } = require('../index')
2
+ const { getBrands3 } = require('../index')
3
3
  const { getSettings } = require('./tempsettings')
4
4
  const { DateTime } = require('luxon');
5
5
 
@@ -83,7 +83,7 @@ let plugins = [
83
83
  resolve: 'gatsby-plugin-less',
84
84
  options: {
85
85
  lessOptions: {
86
- modifyVars: getBrands2(settings.PROJECT.MARKET_KEY).styles,
86
+ modifyVars: getBrands3(settings.PROJECT.MARKET_KEY).styles,
87
87
  },
88
88
  },
89
89
  },
package/index.js CHANGED
@@ -251,6 +251,7 @@ let blendHDN = function (meta) {
251
251
  // Grab neighbor files
252
252
  let { getBrands } = require("./brands");
253
253
  let { getBrands2 } = require("./brands2");
254
+ let { getBrands3 } = require("./brands3");
254
255
  let { getSettings } = require("./settings");
255
256
  let { getNav } = require("./nav");
256
257
  let { getNav2 } = require("./nav2");
@@ -266,6 +267,7 @@ module.exports = {
266
267
  getSettings,
267
268
  getBrands,
268
269
  getBrands2,
270
+ getBrands3,
269
271
  getNav,
270
272
  getNav2,
271
273
  getSpecialNav,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.76",
3
+ "version": "1.4.77",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",
@@ -21,7 +21,7 @@ h1 {
21
21
  //could the next three classes be moved into byline module?
22
22
  .byline-wrapper {
23
23
  max-width: @lg;
24
- border-bottom: 1px solid @grey-75;
24
+ border-bottom: 1px solid @grey-25;
25
25
  margin: @s16 auto @s24;
26
26
  padding-bottom: @s8;
27
27
  display: flex;
@@ -43,6 +43,10 @@ h1 {
43
43
  font-weight: 700;
44
44
  }
45
45
 
46
+ .topper-dateline {
47
+ color: @grey-50;
48
+ }
49
+
46
50
  .byline {
47
51
  text-align: left;
48
52
  display: inline-block;
@@ -214,7 +218,7 @@ h1 {
214
218
  font-family: @sans;
215
219
  font-size: @s14;
216
220
  font-weight: 700;
217
- color: @grey-50;
221
+ color: @grey-75;
218
222
  }
219
223
 
220
224
  @media @tablet {
@@ -223,7 +227,7 @@ h1 {
223
227
  font-family: @sans;
224
228
  font-size: @s14;
225
229
  font-weight: 700;
226
- color: @grey-50;
230
+ color: @grey-75;
227
231
  }
228
232
  }
229
233
  }