@gaulatti/giorgia 0.1.71 → 0.1.72
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/dist/renderer.core.js
CHANGED
|
@@ -6,6 +6,7 @@ let initialized = false;
|
|
|
6
6
|
const layoutCache = new Map();
|
|
7
7
|
let runtimeStyles = '';
|
|
8
8
|
const removedBlockTypes = new Set(['truthSocial', 'truthsocial', 'truth-social', 'truth_social']);
|
|
9
|
+
const defaultSocialImageUrl = 'https://cdn.modoitaliano.fm/assets/default-og.jpg';
|
|
9
10
|
const siteTitlesByLanguage = {
|
|
10
11
|
en: 'ModoItaliano - Breaking News & Current Events',
|
|
11
12
|
es: 'ModoItaliano - Noticias de última hora y actualidad',
|
|
@@ -300,6 +301,32 @@ function registerHelpers() {
|
|
|
300
301
|
return normalizePath(raw);
|
|
301
302
|
}
|
|
302
303
|
});
|
|
304
|
+
Handlebars.registerHelper('socialImageCandidate', (doc) => {
|
|
305
|
+
if (!doc || typeof doc !== 'object')
|
|
306
|
+
return defaultSocialImageUrl;
|
|
307
|
+
const page = doc;
|
|
308
|
+
const seoImage = page.seo?.ogImage?.trim();
|
|
309
|
+
if (seoImage)
|
|
310
|
+
return seoImage;
|
|
311
|
+
if (page.layout === 'article-page') {
|
|
312
|
+
const featuredImage = page.featuredImage?.url?.trim();
|
|
313
|
+
if (featuredImage)
|
|
314
|
+
return featuredImage;
|
|
315
|
+
}
|
|
316
|
+
return defaultSocialImageUrl;
|
|
317
|
+
});
|
|
318
|
+
Handlebars.registerHelper('socialImageAlt', (doc) => {
|
|
319
|
+
if (!doc || typeof doc !== 'object')
|
|
320
|
+
return 'ModoItaliano';
|
|
321
|
+
const page = doc;
|
|
322
|
+
if (page.layout === 'article-page') {
|
|
323
|
+
const featuredAlt = page.featuredImage?.alt?.trim();
|
|
324
|
+
if (featuredAlt)
|
|
325
|
+
return featuredAlt;
|
|
326
|
+
}
|
|
327
|
+
const title = page.seo?.metaTitle?.trim() || page.title?.trim();
|
|
328
|
+
return title || 'ModoItaliano';
|
|
329
|
+
});
|
|
303
330
|
}
|
|
304
331
|
function registerPartials(partials) {
|
|
305
332
|
for (const [name, template] of Object.entries(partials)) {
|
package/package.json
CHANGED
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
{{else}}
|
|
27
27
|
<meta property='og:type' content='website' />
|
|
28
28
|
{{/if}}
|
|
29
|
-
{{#with (socialImageUrl (
|
|
29
|
+
{{#with (socialImageUrl (socialImageCandidate this)) as |socialImage|}}
|
|
30
30
|
{{#if socialImage}}
|
|
31
31
|
<meta property='og:image' content='{{socialImage}}' />
|
|
32
32
|
<meta property='og:image:type' content='image/jpeg' />
|
|
33
33
|
<meta property='og:image:width' content='1200' />
|
|
34
34
|
<meta property='og:image:height' content='630' />
|
|
35
|
-
<meta property='og:image:alt' content='{{
|
|
35
|
+
<meta property='og:image:alt' content='{{socialImageAlt @root}}' />
|
|
36
36
|
{{/if}}
|
|
37
37
|
<meta name='twitter:card' content='{{#if socialImage}}summary_large_image{{else}}summary{{/if}}' />
|
|
38
38
|
{{#if socialImage}}
|
|
39
39
|
<meta name='twitter:image' content='{{socialImage}}' />
|
|
40
40
|
<meta name='twitter:image:src' content='{{socialImage}}' />
|
|
41
|
-
<meta name='twitter:image:alt' content='{{
|
|
41
|
+
<meta name='twitter:image:alt' content='{{socialImageAlt @root}}' />
|
|
42
42
|
{{/if}}
|
|
43
43
|
{{/with}}
|
|
44
44
|
<meta name='twitter:site' content='@modoitaliano' />
|