@@ -202,7 +202,7 @@ export function deriveItemData({
202
202
} ) {
203
203
return {
204
204
...item ,
205
- authors : itemEnrichment ?. authors || item ?. authors || false ,
205
+ authors : item ?. preview ?. authors || itemEnrichment ?. authors || item ?. authors || false ,
206
206
title : title ( { item, itemEnrichment, node } ) ,
207
207
thumbnail : thumbnail ( { item, itemEnrichment } ) ,
208
208
excerpt : excerpt ( { item, itemEnrichment } ) ,
@@ -239,6 +239,7 @@ function title({ item, itemEnrichment, node }) {
239
239
const file = urlToUse ?. substring ( urlToUse . lastIndexOf ( '/' ) + 1 )
240
240
const fileName = file ? file . replace ( / \. [ ^ / . ] + $ / , '' ) : false
241
241
return (
242
+ item ?. preview ?. title ||
242
243
node ?. title ||
243
244
itemEnrichment ?. title ||
244
245
item ?. collection ?. title ||
@@ -258,8 +259,14 @@ function title({ item, itemEnrichment, node }) {
258
259
* @returns {string:url } The most appropriate image to show as a thumbnail
259
260
*/
260
261
function thumbnail ( { item, itemEnrichment } ) {
262
+ const previewImage = item ?. preview ?. image ?. cachedImages [ 0 ] ?. url
261
263
const passedImage =
262
- itemEnrichment ?. thumbnail || item ?. thumbnail || item ?. topImageUrl || item ?. image ?. url || false
264
+ previewImage ||
265
+ itemEnrichment ?. thumbnail ||
266
+ item ?. thumbnail ||
267
+ item ?. topImageUrl ||
268
+ item ?. image ?. url ||
269
+ false
263
270
if ( passedImage ) return passedImage
264
271
265
272
const firstImage = item ?. images ?. [ Object . keys ( item ?. images ) [ 0 ] ] ?. src
@@ -278,6 +285,7 @@ function publisher({ item, itemEnrichment, passedPublisher }) {
278
285
const syndicatedPublisher = item ?. syndicatedArticle ?. publisher ?. name
279
286
//prettier-ignore
280
287
return (
288
+ item ?. preview ?. domain ?. name || // Preview Metadata
281
289
syndicatedPublisher || // Syndicated - provided by curation
282
290
passedPublisher || // Collections - hardcoded as 'Pocket'
283
291
itemEnrichment ?. publisher || // Home - curatedInfo: provided by curation || Collection - publisher: provided by curation
@@ -296,7 +304,13 @@ function publisher({ item, itemEnrichment, passedPublisher }) {
296
304
* @returns {string } The most appropriate excerpt to show
297
305
*/
298
306
function excerpt ( { item, itemEnrichment } ) {
299
- return itemEnrichment ?. excerpt || item ?. collection ?. excerpt || item ?. excerpt || null
307
+ return (
308
+ item ?. preview ?. excerpt ||
309
+ itemEnrichment ?. excerpt ||
310
+ item ?. collection ?. excerpt ||
311
+ item ?. excerpt ||
312
+ null
313
+ )
300
314
}
301
315
302
316
/**
@@ -326,7 +340,7 @@ function isReadable({ item }) {
326
340
* @returns {string } The url that opens to a non-pocket site
327
341
*/
328
342
function externalUrl ( { item, itemEnrichment, utmId = 'pocket_saves' } ) {
329
- const urlToUse = itemEnrichment ?. url || item ?. givenUrl || item ?. resolvedUrl
343
+ const urlToUse = item ?. preview ?. url || itemEnrichment ?. url || item ?. givenUrl || item ?. resolvedUrl
330
344
const linkWithUTM = replaceUTM ( urlToUse , utmId )
331
345
return linkWithUTM
332
346
}
@@ -337,7 +351,7 @@ function externalUrl({ item, itemEnrichment, utmId = 'pocket_saves' }) {
337
351
* @returns {string } The url that should be saved or opened
338
352
*/
339
353
function saveUrl ( { item, itemEnrichment } ) {
340
- return itemEnrichment ?. url || item ?. givenUrl || item ?. resolvedUrl || false
354
+ return item ?. preview ?. url || itemEnrichment ?. url || item ?. givenUrl || item ?. resolvedUrl || false
341
355
}
342
356
343
357
/** ANALYTICS URL
@@ -346,7 +360,14 @@ function saveUrl({ item, itemEnrichment }) {
346
360
* @returns {string } The url that should be passed to analytics
347
361
*/
348
362
function analyticsUrl ( { node, item, itemEnrichment } ) {
349
- return node ?. url || item ?. givenUrl || item ?. resolvedUrl || itemEnrichment ?. url || false
363
+ return (
364
+ item ?. preview ?. url ||
365
+ node ?. url ||
366
+ item ?. givenUrl ||
367
+ item ?. resolvedUrl ||
368
+ itemEnrichment ?. url ||
369
+ false
370
+ )
350
371
}
351
372
352
373
/** READ URl
@@ -379,7 +400,7 @@ export function readUrl({ item, node, itemEnrichment, status }) {
379
400
if ( ! readable ) return external
380
401
381
402
// Otherwise we are gonna open it in reader view
382
- const itemId = item ?. readerSlug || node ?. id || item ?. itemId
403
+ const itemId = item ?. shareId || node ?. id || item ?. itemId
383
404
return `/read/${ itemId } `
384
405
}
385
406
0 commit comments