@mindful-web/marko-web-theme-monorail 1.98.0 → 1.98.4
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/components/ads/fixed-ad-bottom.marko.js +2 -2
- package/components/ads/reveal-ad-handler.marko.js +2 -2
- package/components/blocks/author-bios.marko.js +2 -2
- package/components/blocks/callout-cards.marko.js +2 -2
- package/components/blocks/company-inquiry-form.marko.js +2 -2
- package/components/blocks/company-search.marko.js +2 -2
- package/components/blocks/content-card-deck.marko.js +2 -2
- package/components/blocks/content-meter.marko.js +2 -2
- package/components/blocks/full-width-native-ad.marko.js +2 -2
- package/components/blocks/geo-summary.marko +10 -21
- package/components/blocks/geo-summary.marko.js +13 -42
- package/components/blocks/header-announcement.marko.js +2 -2
- package/components/blocks/hero-card.marko.js +2 -2
- package/components/blocks/latest-content-list.marko.js +2 -2
- package/components/blocks/latest-podcast.marko.js +2 -2
- package/components/blocks/latest-products-feed.marko.js +2 -2
- package/components/blocks/marko.json +1 -0
- package/components/blocks/more-products.marko.js +2 -2
- package/components/blocks/most-popular-list.marko.js +2 -2
- package/components/blocks/most-popular.marko.js +2 -2
- package/components/blocks/native-x-card-deck.marko.js +2 -2
- package/components/blocks/native-x-promo-card.marko.js +2 -2
- package/components/blocks/newsletter-signup-banner-external.marko.js +2 -2
- package/components/blocks/newsletter-signup-banner-large.marko.js +2 -2
- package/components/blocks/newsletter-signup-banner.marko.js +2 -2
- package/components/blocks/opinion.marko.js +2 -2
- package/components/blocks/primary-image.marko.js +2 -2
- package/components/blocks/products.marko.js +2 -2
- package/components/blocks/read-next.marko.js +2 -2
- package/components/blocks/related-stories.marko.js +2 -2
- package/components/blocks/resource-library.marko.js +2 -2
- package/components/blocks/section-body-feed.marko.js +2 -2
- package/components/blocks/section-card-deck-featured.marko.js +2 -2
- package/components/blocks/section-card-deck.marko.js +2 -2
- package/components/blocks/section-card-list.marko.js +2 -2
- package/components/blocks/section-feed.marko +1 -0
- package/components/blocks/section-feed.marko.js +3 -2
- package/components/blocks/section-forbes.marko.js +2 -2
- package/components/blocks/section-list-deck.marko.js +2 -2
- package/components/blocks/section-list.marko.js +2 -2
- package/components/blocks/section-search.marko.js +2 -2
- package/components/blocks/section-title-feed.marko.js +2 -2
- package/components/blocks/top-stories-menu.marko.js +2 -2
- package/components/blocks/top-stories.marko.js +2 -2
- package/components/blocks/white-papers.marko.js +2 -2
- package/components/breadcrumbs/content-page.marko.js +2 -2
- package/components/breadcrumbs/index.marko.js +2 -2
- package/components/breadcrumbs/website-section.marko.js +2 -2
- package/components/breadcrumbs/with-home.marko.js +2 -2
- package/components/client-side-block-loader.marko.js +2 -2
- package/components/client-side-blocks/most-popular-list.marko.js +2 -2
- package/components/client-side-blocks/most-popular.marko.js +2 -2
- package/components/content/body-with-injection.marko.js +2 -2
- package/components/content/contact-details/index.marko.js +2 -2
- package/components/content/contact-details/section.marko.js +2 -2
- package/components/content/download/form-dot-com.marko.js +2 -2
- package/components/content/download/identity-x.marko.js +2 -2
- package/components/content/download/index.marko.js +2 -2
- package/components/content/download/link.marko.js +2 -2
- package/components/content/download/wufoo.marko.js +2 -2
- package/components/content/link-url/index.marko.js +2 -2
- package/components/content/sections-listed-in.marko.js +2 -2
- package/components/content-attribution/attribution.marko.js +2 -2
- package/components/content-attribution/components/authors.marko.js +2 -2
- package/components/content-attribution/components/byline.marko.js +2 -2
- package/components/content-attribution/components/company.marko.js +2 -2
- package/components/content-attribution/components/contributors.marko.js +2 -2
- package/components/content-attribution/components/photographers.marko.js +2 -2
- package/components/content-attribution/components/source.marko.js +2 -2
- package/components/content-attribution/components/speakers.marko.js +2 -2
- package/components/content-attribution/components/sponsors.marko.js +2 -2
- package/components/content-attribution/index.marko.js +2 -2
- package/components/directory-facets/facet-container/facet-container.marko.js +2 -2
- package/components/directory-facets/facet-list/facet-list.marko.js +2 -2
- package/components/directory-facets/facet.marko.js +2 -2
- package/components/directory-facets/index.marko.js +2 -2
- package/components/facebook-connect.marko.js +2 -2
- package/components/flows/card-deck.marko.js +2 -2
- package/components/flows/content/card-deck-col.marko.js +2 -2
- package/components/flows/content/directory-section.marko.js +2 -2
- package/components/flows/content/list.marko.js +2 -2
- package/components/flows/marko.json +1 -0
- package/components/flows/section-feed.marko +2 -0
- package/components/flows/section-feed.marko.js +4 -2
- package/components/gam/components/define-display-ad.marko.js +2 -2
- package/components/gam/define-display-ad.marko.js +2 -2
- package/components/gam/inject-ads.marko.js +2 -2
- package/components/gam/wallpaper-ad.marko.js +2 -2
- package/components/google-preferred-source/index.marko.js +2 -2
- package/components/google-preferred-source/init.marko.js +2 -2
- package/components/identity-x/comment-stream.marko.js +2 -2
- package/components/identity-x/content-page-gate.marko.js +2 -2
- package/components/identity-x/newsletter-footer.marko.js +2 -2
- package/components/identity-x/newsletter-inline.marko.js +2 -2
- package/components/identity-x/newsletter-modal.marko.js +2 -2
- package/components/identity-x/newsletter-pushdown.marko.js +2 -2
- package/components/identity-x/progressive-profile-gate.marko.js +2 -2
- package/components/layouts/ad-preview.marko.js +2 -2
- package/components/menu-toggle-button.marko.js +2 -2
- package/components/native-x/render.marko.js +2 -2
- package/components/nodes/author-bio.marko.js +2 -2
- package/components/nodes/author-card.marko.js +2 -2
- package/components/nodes/author-published.marko.js +2 -2
- package/components/nodes/author.marko.js +2 -2
- package/components/nodes/components/attribution.marko.js +2 -2
- package/components/nodes/components/authors.marko.js +2 -2
- package/components/nodes/components/company-name.marko.js +2 -2
- package/components/nodes/components/dates.marko.js +2 -2
- package/components/nodes/components/section-sponsor.marko.js +2 -2
- package/components/nodes/content-published.marko.js +2 -2
- package/components/nodes/content.marko.js +2 -2
- package/components/nodes/directory-section-feed-content.marko.js +2 -2
- package/components/nodes/featured-products-card.marko.js +2 -2
- package/components/nodes/product-feed-content.marko.js +2 -2
- package/components/nodes/section-feed-content.marko.js +2 -2
- package/components/nodes/standard-promo.marko.js +2 -2
- package/components/nodes/youtube-card.marko.js +2 -2
- package/components/page/attribution.marko.js +2 -2
- package/components/page/contact-details.marko.js +2 -2
- package/components/page/content.marko.js +2 -2
- package/components/page/contents.marko.js +2 -2
- package/components/page/dates.marko.js +2 -2
- package/components/page/default.marko.js +2 -2
- package/components/page/website-section.marko.js +2 -2
- package/components/pagination-controls.marko.js +2 -2
- package/components/query-total-count.marko.js +2 -2
- package/components/reveal-ad-handler.marko.js +2 -2
- package/components/site-footer/container.marko.js +2 -2
- package/components/site-footer/copyright.marko.js +2 -2
- package/components/site-footer/index.marko.js +2 -2
- package/components/site-footer/social-icons.marko.js +2 -2
- package/components/site-header.marko.js +2 -2
- package/components/site-menu/components/search.marko.js +2 -2
- package/components/site-menu/components/social-icons.marko.js +2 -2
- package/components/site-menu/header.marko.js +2 -2
- package/components/site-menu/index.marko.js +2 -2
- package/components/site-menu/section.marko.js +2 -2
- package/components/site-navbar/brand.marko.js +2 -2
- package/components/site-navbar/index.marko.js +2 -2
- package/components/site-navbar/item.marko.js +2 -2
- package/components/site-navbar/items.marko.js +2 -2
- package/components/site-navbar/logo.marko.js +2 -2
- package/components/site-navbar/search.marko.js +2 -2
- package/components/site-newsletter-menu.marko.js +2 -2
- package/components/social/icon-link.marko.js +2 -2
- package/components/social/icons.marko.js +2 -2
- package/components/social-follow.marko.js +2 -2
- package/components/sponsored-label-logo.marko.js +2 -2
- package/components/sponsored-section-logo.marko.js +2 -2
- package/components/sponsored-section-name-logo.marko.js +2 -2
- package/components/ssr-html-inject.marko.js +2 -2
- package/package.json +2 -2
- package/templates/ad-preview.marko.js +2 -2
- package/templates/content/components/presented-by.marko.js +2 -2
- package/templates/content/native-x-story.marko.js +2 -2
- package/templates/content/print.marko.js +2 -2
- package/templates/email-preview.marko.js +2 -2
- package/templates/search.marko.js +2 -2
- package/templates/taxonomy.marko.js +2 -2
- package/test/utils/geo-summary-visible.spec.js +82 -0
- package/utils/geo-summary-visible.js +41 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-theme-monorail$1.98.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-theme-monorail$1.98.4/templates/search.marko",
|
|
6
6
|
marko_component = require("./search.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_queryFragment = require("../graphql/fragments/section-feed-block"),
|
|
@@ -301,7 +301,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
301
301
|
}, marko_component);
|
|
302
302
|
|
|
303
303
|
marko_template.meta = {
|
|
304
|
-
id: "/@mindful-web/marko-web-theme-monorail$1.98.
|
|
304
|
+
id: "/@mindful-web/marko-web-theme-monorail$1.98.4/templates/search.marko",
|
|
305
305
|
component: "./search.marko",
|
|
306
306
|
tags: [
|
|
307
307
|
"@mindful-web/marko-web-p1-events/components/track-search.marko",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
-
marko_componentType = "/@mindful-web/marko-web-theme-monorail$1.98.
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-theme-monorail$1.98.4/templates/taxonomy.marko",
|
|
6
6
|
marko_component = require("./taxonomy.marko"),
|
|
7
7
|
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
8
|
module_hierarchyAliases = require("@mindful-web/marko-web/utils/hierarchy-aliases"),
|
|
@@ -174,7 +174,7 @@ marko_template._ = marko_renderer(render, {
|
|
|
174
174
|
}, marko_component);
|
|
175
175
|
|
|
176
176
|
marko_template.meta = {
|
|
177
|
-
id: "/@mindful-web/marko-web-theme-monorail$1.98.
|
|
177
|
+
id: "/@mindful-web/marko-web-theme-monorail$1.98.4/templates/taxonomy.marko",
|
|
178
178
|
component: "./taxonomy.marko",
|
|
179
179
|
tags: [
|
|
180
180
|
"../components/gam/define-display-ad.marko",
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const { describe, it } = require('mocha');
|
|
2
|
+
const { expect } = require('chai');
|
|
3
|
+
const geoSummaryVisible = require('../../utils/geo-summary-visible');
|
|
4
|
+
|
|
5
|
+
const words = (n) => `<p>${Array(n).fill('word').join(' ')}</p>`;
|
|
6
|
+
const make = (overrides = {}) => ({
|
|
7
|
+
type: 'article',
|
|
8
|
+
geoSummary: 'A summary.',
|
|
9
|
+
geoSummaryDisplay: 'DEFAULT',
|
|
10
|
+
body: words(301),
|
|
11
|
+
...overrides,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe('utils/geo-summary-visible', () => {
|
|
15
|
+
it('shows a long article with a summary', () => {
|
|
16
|
+
expect(geoSummaryVisible(make())).to.equal(true);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('hides when there is no summary, even when VISIBLE', () => {
|
|
20
|
+
expect(geoSummaryVisible(make({ geoSummary: null, geoSummaryDisplay: 'VISIBLE' }))).to.equal(false);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('hides when HIDDEN', () => {
|
|
24
|
+
expect(geoSummaryVisible(make({ geoSummaryDisplay: 'HIDDEN' }))).to.equal(false);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('defaults to article and news only', () => {
|
|
28
|
+
expect(geoSummaryVisible(make({ type: 'news' }))).to.equal(true);
|
|
29
|
+
expect(geoSummaryVisible(make({ type: 'product' }))).to.equal(false);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('honors includeContentTypes', () => {
|
|
33
|
+
const content = make({ type: 'product' });
|
|
34
|
+
expect(geoSummaryVisible(content, { includeContentTypes: ['product'] })).to.equal(true);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('requires more than minBodyWordCount words of body text', () => {
|
|
38
|
+
expect(geoSummaryVisible(make({ body: words(300) }))).to.equal(false);
|
|
39
|
+
expect(geoSummaryVisible(make({ body: null }))).to.equal(false);
|
|
40
|
+
expect(geoSummaryVisible(make({ body: words(51) }), { minBodyWordCount: 50 })).to.equal(true);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('ignores markup when counting words', () => {
|
|
44
|
+
const body = `<div><img src="x.jpg"></div>${words(150)}<p> -- </p>${words(150)}`;
|
|
45
|
+
expect(geoSummaryVisible(make({ body }))).to.equal(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('reads geoSummaryDisplay in any case', () => {
|
|
49
|
+
expect(geoSummaryVisible(make({ geoSummaryDisplay: 'hidden' }))).to.equal(false);
|
|
50
|
+
expect(geoSummaryVisible(make({ type: 'product', body: '', geoSummaryDisplay: 'Visible' }))).to.equal(true);
|
|
51
|
+
expect(geoSummaryVisible(make({ geoSummaryDisplay: 'default' }), { defaultDisplay: 'HIDDEN' })).to.equal(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('applies the normal rules when geoSummaryDisplay is unset', () => {
|
|
55
|
+
expect(geoSummaryVisible(make({ geoSummaryDisplay: null }))).to.equal(true);
|
|
56
|
+
expect(geoSummaryVisible(make({ geoSummaryDisplay: undefined, type: 'product' }))).to.equal(false);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('lets VISIBLE override the type and length rules', () => {
|
|
60
|
+
const content = make({ type: 'product', body: '', geoSummaryDisplay: 'VISIBLE' });
|
|
61
|
+
expect(geoSummaryVisible(content)).to.equal(true);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('suppresses DEFAULT content when defaultDisplay is hidden, in any case', () => {
|
|
65
|
+
['hidden', 'HIDDEN', 'Hidden'].forEach((defaultDisplay) => {
|
|
66
|
+
expect(geoSummaryVisible(make(), { defaultDisplay })).to.equal(false);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('still shows VISIBLE content when defaultDisplay is hidden', () => {
|
|
71
|
+
const content = make({ geoSummaryDisplay: 'VISIBLE' });
|
|
72
|
+
expect(geoSummaryVisible(content, { defaultDisplay: 'hidden' })).to.equal(true);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('applies the normal rules when defaultDisplay is visible, in any case', () => {
|
|
76
|
+
['visible', 'VISIBLE'].forEach((defaultDisplay) => {
|
|
77
|
+
expect(geoSummaryVisible(make(), { defaultDisplay })).to.equal(true);
|
|
78
|
+
expect(geoSummaryVisible(make({ type: 'product' }), { defaultDisplay })).to.equal(false);
|
|
79
|
+
expect(geoSummaryVisible(make({ body: words(10) }), { defaultDisplay })).to.equal(false);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const { get } = require('@mindful-web/object-path');
|
|
2
|
+
const { stripHtml } = require('@mindful-web/html');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether the GEO "Article Summary" card (`<theme-content-geo-summary-block>`) renders for
|
|
6
|
+
* this content. The block uses this for its own show/hide decision, so layouts can call it
|
|
7
|
+
* with the same options to adjust around the card (e.g. un-float the primary image).
|
|
8
|
+
*
|
|
9
|
+
* `geoSummaryDisplay` governs the card: HIDDEN suppresses it (the summary may still feed the
|
|
10
|
+
* head meta tag + JSON-LD); VISIBLE forces it on and overrides both the content-type and
|
|
11
|
+
* body-length restrictions; DEFAULT uses the `defaultDisplay` setting.
|
|
12
|
+
*
|
|
13
|
+
* `defaultDisplay` is case-insensitive: "hidden" suppresses DEFAULT content; "visible" (the
|
|
14
|
+
* default) applies the normal content-type and body-length rules -- it never forces the card on.
|
|
15
|
+
*
|
|
16
|
+
* @param {object} content The content node (needs geoSummary, geoSummaryDisplay, type, body).
|
|
17
|
+
* @param {object} [options]
|
|
18
|
+
* @param {string[]} [options.includeContentTypes] Content types the card may show on.
|
|
19
|
+
* @param {number} [options.minBodyWordCount] Body must have more words than this.
|
|
20
|
+
* @param {string} [options.defaultDisplay] "visible" or "hidden" (any case); applies when
|
|
21
|
+
* geoSummaryDisplay is DEFAULT.
|
|
22
|
+
* @returns {boolean}
|
|
23
|
+
*/
|
|
24
|
+
module.exports = (content, {
|
|
25
|
+
includeContentTypes = ['article', 'news'],
|
|
26
|
+
minBodyWordCount = 300,
|
|
27
|
+
defaultDisplay = 'visible',
|
|
28
|
+
} = {}) => {
|
|
29
|
+
if (!get(content, 'geoSummary')) return false;
|
|
30
|
+
// The API types geoSummaryDisplay as a plain String, so don't rely on its casing.
|
|
31
|
+
const contentDisplay = `${get(content, 'geoSummaryDisplay') || ''}`.toUpperCase();
|
|
32
|
+
if (contentDisplay === 'HIDDEN') return false;
|
|
33
|
+
if (contentDisplay === 'VISIBLE') return true;
|
|
34
|
+
if (contentDisplay === 'DEFAULT' && `${defaultDisplay}`.toUpperCase() === 'HIDDEN') return false;
|
|
35
|
+
if (!includeContentTypes.includes(get(content, 'type'))) return false;
|
|
36
|
+
// Only surface the summary on long-form content: require more than `minBodyWordCount`
|
|
37
|
+
// words of body prose once all HTML and embeds are stripped (stripHtml -> plain text).
|
|
38
|
+
const bodyText = stripHtml(get(content, 'body') || '');
|
|
39
|
+
const bodyWordCount = bodyText ? bodyText.split(/\s+/).filter((w) => /\w/.test(w)).length : 0;
|
|
40
|
+
return bodyWordCount > minBodyWordCount;
|
|
41
|
+
};
|