How to use @tryghost/social-urls - 6 common examples

To help you get started, we’ve selected a few @tryghost/social-urls examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TryGhost / Ghost / core / frontend / meta / structured_data.js View on Github external
structuredData = {
        'og:site_name': metaData.site.title,
        'og:type': metaData.ogType,
        'og:title': metaData.ogTitle,
        // CASE: metaData.excerpt for post context is populated by either the custom excerpt,
        // the meta description, or the automated excerpt of 50 words. It is empty for any
        // other context and *always* uses the provided meta description fields.
        'og:description': metaData.ogDescription,
        'og:url': metaData.canonicalUrl,
        'og:image': metaData.ogImage.url || metaData.coverImage.url,
        'article:published_time': metaData.publishedDate,
        'article:modified_time': metaData.modifiedDate,
        'article:tag': metaData.keywords,
        'article:publisher': metaData.site.facebook ? socialUrls.facebook(metaData.site.facebook) : undefined,
        'article:author': metaData.authorFacebook ? socialUrls.facebook(metaData.authorFacebook) : undefined,
        'twitter:card': card,
        'twitter:title': metaData.twitterTitle,
        'twitter:description': metaData.twitterDescription,
        'twitter:url': metaData.canonicalUrl,
        'twitter:image': metaData.twitterImage || metaData.coverImage.url,
        'twitter:label1': metaData.authorName ? 'Written by' : undefined,
        'twitter:data1': metaData.authorName,
        'twitter:label2': metaData.keywords ? 'Filed under' : undefined,
        'twitter:data2': metaData.keywords ? metaData.keywords.join(', ') : undefined,
        'twitter:site': metaData.site.twitter || undefined,
        'twitter:creator': metaData.creatorTwitter || undefined
    };

    if (metaData.ogImage.dimensions) {
        structuredData['og:image:width'] = metaData.ogImage.dimensions.width;
        structuredData['og:image:height'] = metaData.ogImage.dimensions.height;
github TryGhost / Ghost / core / frontend / meta / structured_data.js View on Github external
}

    structuredData = {
        'og:site_name': metaData.site.title,
        'og:type': metaData.ogType,
        'og:title': metaData.ogTitle,
        // CASE: metaData.excerpt for post context is populated by either the custom excerpt,
        // the meta description, or the automated excerpt of 50 words. It is empty for any
        // other context and *always* uses the provided meta description fields.
        'og:description': metaData.ogDescription,
        'og:url': metaData.canonicalUrl,
        'og:image': metaData.ogImage.url || metaData.coverImage.url,
        'article:published_time': metaData.publishedDate,
        'article:modified_time': metaData.modifiedDate,
        'article:tag': metaData.keywords,
        'article:publisher': metaData.site.facebook ? socialUrls.facebook(metaData.site.facebook) : undefined,
        'article:author': metaData.authorFacebook ? socialUrls.facebook(metaData.authorFacebook) : undefined,
        'twitter:card': card,
        'twitter:title': metaData.twitterTitle,
        'twitter:description': metaData.twitterDescription,
        'twitter:url': metaData.canonicalUrl,
        'twitter:image': metaData.twitterImage || metaData.coverImage.url,
        'twitter:label1': metaData.authorName ? 'Written by' : undefined,
        'twitter:data1': metaData.authorName,
        'twitter:label2': metaData.keywords ? 'Filed under' : undefined,
        'twitter:data2': metaData.keywords ? metaData.keywords.join(', ') : undefined,
        'twitter:site': metaData.site.twitter || undefined,
        'twitter:creator': metaData.creatorTwitter || undefined
    };

    if (metaData.ogImage.dimensions) {
        structuredData['og:image:width'] = metaData.ogImage.dimensions.width;
github TryGhost / Ghost / core / frontend / meta / schema.js View on Github external
function trimSameAs(data, context) {
    var sameAs = [];

    if (context === 'post' || context === 'page') {
        if (data[context].primary_author.website) {
            sameAs.push(escapeExpression(data[context].primary_author.website));
        }
        if (data[context].primary_author.facebook) {
            sameAs.push(socialUrls.facebook(data[context].primary_author.facebook));
        }
        if (data[context].primary_author.twitter) {
            sameAs.push(socialUrls.twitter(data[context].primary_author.twitter));
        }
    } else if (context === 'author') {
        if (data.author.website) {
            sameAs.push(escapeExpression(data.author.website));
        }
        if (data.author.facebook) {
            sameAs.push(socialUrls.facebook(data.author.facebook));
        }
        if (data.author.twitter) {
            sameAs.push(socialUrls.twitter(data.author.twitter));
        }
    }
github TryGhost / Ghost / core / frontend / meta / schema.js View on Github external
if (context === 'post' || context === 'page') {
        if (data[context].primary_author.website) {
            sameAs.push(escapeExpression(data[context].primary_author.website));
        }
        if (data[context].primary_author.facebook) {
            sameAs.push(socialUrls.facebook(data[context].primary_author.facebook));
        }
        if (data[context].primary_author.twitter) {
            sameAs.push(socialUrls.twitter(data[context].primary_author.twitter));
        }
    } else if (context === 'author') {
        if (data.author.website) {
            sameAs.push(escapeExpression(data.author.website));
        }
        if (data.author.facebook) {
            sameAs.push(socialUrls.facebook(data.author.facebook));
        }
        if (data.author.twitter) {
            sameAs.push(socialUrls.twitter(data.author.twitter));
        }
    }

    return sameAs;
}
github TryGhost / Ghost / core / frontend / meta / schema.js View on Github external
}
        if (data[context].primary_author.facebook) {
            sameAs.push(socialUrls.facebook(data[context].primary_author.facebook));
        }
        if (data[context].primary_author.twitter) {
            sameAs.push(socialUrls.twitter(data[context].primary_author.twitter));
        }
    } else if (context === 'author') {
        if (data.author.website) {
            sameAs.push(escapeExpression(data.author.website));
        }
        if (data.author.facebook) {
            sameAs.push(socialUrls.facebook(data.author.facebook));
        }
        if (data.author.twitter) {
            sameAs.push(socialUrls.twitter(data.author.twitter));
        }
    }

    return sameAs;
}
github TryGhost / Ghost / core / frontend / meta / schema.js View on Github external
function trimSameAs(data, context) {
    var sameAs = [];

    if (context === 'post' || context === 'page') {
        if (data[context].primary_author.website) {
            sameAs.push(escapeExpression(data[context].primary_author.website));
        }
        if (data[context].primary_author.facebook) {
            sameAs.push(socialUrls.facebook(data[context].primary_author.facebook));
        }
        if (data[context].primary_author.twitter) {
            sameAs.push(socialUrls.twitter(data[context].primary_author.twitter));
        }
    } else if (context === 'author') {
        if (data.author.website) {
            sameAs.push(escapeExpression(data.author.website));
        }
        if (data.author.facebook) {
            sameAs.push(socialUrls.facebook(data.author.facebook));
        }
        if (data.author.twitter) {
            sameAs.push(socialUrls.twitter(data.author.twitter));
        }
    }

    return sameAs;
}

@tryghost/social-urls

## Install

MIT
Latest version published 11 days ago

Package Health Score

69 / 100
Full package analysis

Popular @tryghost/social-urls functions

Similar packages