@automattic/social-previews
Version:
A suite of components to generate previews for a post for both social and search engines.
6 lines • 463 B
JavaScript
import { firstValid, hardTruncation, shortEnough, stripHtmlTags } from '../helpers';
const TITLE_LENGTH = 1000;
const DESCRIPTION_LENGTH = 400;
export const tumblrTitle = (text) => firstValid(shortEnough(TITLE_LENGTH), hardTruncation(TITLE_LENGTH))(stripHtmlTags(text)) || '';
export const tumblrDescription = (text) => firstValid(shortEnough(DESCRIPTION_LENGTH), hardTruncation(DESCRIPTION_LENGTH))(stripHtmlTags(text)) || '';
//# sourceMappingURL=helpers.js.map