UNPKG

@automattic/social-previews

Version:

A suite of components to generate previews for a post for both social and search engines.

21 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.blueskyUrl = exports.blueskyBody = exports.blueskyTitle = void 0; const helpers_1 = require("../helpers"); const TITLE_LENGTH = 200; const BODY_LENGTH = 300; const URL_LENGTH = 40; const blueskyTitle = (text) => (0, helpers_1.firstValid)((0, helpers_1.shortEnough)(TITLE_LENGTH), (0, helpers_1.hardTruncation)(TITLE_LENGTH))((0, helpers_1.stripHtmlTags)(text)) || ''; exports.blueskyTitle = blueskyTitle; const blueskyBody = (text, options = {}) => { const { offset = 0 } = options; return (0, helpers_1.preparePreviewText)(text, { platform: 'bluesky', maxChars: BODY_LENGTH - URL_LENGTH - offset, }); }; exports.blueskyBody = blueskyBody; const blueskyUrl = (text) => (0, helpers_1.firstValid)((0, helpers_1.shortEnough)(URL_LENGTH), (0, helpers_1.hardTruncation)(URL_LENGTH))((0, helpers_1.stripHtmlTags)(text)) || ''; exports.blueskyUrl = blueskyUrl; //# sourceMappingURL=helpers.js.map