How to use the @tryghost/helpers.tags function in @tryghost/helpers

To help you get started, we’ve selected a few @tryghost/helpers 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 / docs / src / utils / getTagsforPostCollection.js View on Github external
_.forEach(posts, ({ node }) => {
        const publicTags = tagsHelper(node, { visibility: `public`, fn: tag => tag })
        tags.push(publicTags)
    })
github TryGhost / gatsby-starter-ghost / src / components / common / meta / ArticleMeta.js View on Github external
const ArticleMetaGhost = ({ data, settings, canonical }) => {
    const ghostPost = data
    settings = settings.allGhostSettings.edges[0].node

    const author = getAuthorProperties(ghostPost.primary_author)
    const publicTags = _.map(tagsHelper(ghostPost, { visibility: `public`, fn: tag => tag }), `name`)
    const primaryTag = publicTags[0] || ``
    const shareImage = ghostPost.feature_image ? ghostPost.feature_image : _.get(settings, `cover_image`, null)
    const publisherLogo = (settings.logo || config.siteIcon) ? url.resolve(config.siteUrl, (settings.logo || config.siteIcon)) : null

    const jsonLd = {
        "@context": `https://schema.org/`,
        "@type": `Article`,
        author: {
            "@type": `Person`,
            name: author.name,
            image: author.image ? author.image : undefined,
            sameAs: author.sameAsArray ? author.sameAsArray : undefined,
        },
        keywords: publicTags.length ? publicTags.join(`, `) : undefined,
        headline: ghostPost.meta_title || ghostPost.title,
        url: canonical,
github TryGhost / docs / src / components / common / meta / ArticleMetaGhost.js View on Github external
const ArticleMetaGhost = ({ data, canonical, fetchAuthorData, title, overwriteDefaultImage, image }) => {
    const { ghostPost } = data
    const { siteMetadata } = data.site

    const author = getAuthorProperties(ghostPost.primary_author, fetchAuthorData)
    const publicTags = _.map(tagsHelper(ghostPost, { visibility: `public`, fn: tag => tag }), `name`)
    const primaryTag = publicTags[0] || { name: `General`, slug: `general` }
    const seoImage = (overwriteDefaultImage && ghostPost.feature_image) ? ghostPost.feature_image : image

    return (
        <>
            
                <title>{ghostPost.meta_title || title || ghostPost.title}</title>
github TryGhost / docs / src / components / common / Tags.js View on Github external
<span>{props.suffix}</span>
    }

    opts.fn = function process(tag) {
        let tagLink = props.permalink
        tagLink = tagLink.replace(/:slug/, tag.slug) || `/${tag.slug}/`

        return props.autolink ?
            <span>
                {tag.name}
            </span> :
            <span>{tag.name}</span>
    }

    return (
        tagsHelper(props.post, opts)
    )
}

@tryghost/helpers

Javascript Helpers for working with the Ghost [Content API](https://ghost.org/docs/content-api/)

MIT
Latest version published 10 days ago

Package Health Score

69 / 100
Full package analysis

Similar packages