0.3.0 • Published 3 years ago

@maiertech/gatsby-theme-tweets-core v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@maiertech/gatsby-theme-tweets-core

A Gatsby theme to add a Tweet interface and MdxTweet type to Gatsby sites.

Options

OptionDefaultDescription
collectiontweetsThe collection is added to Tweet nodes and as field to the underlying Mdx node. It is also part of the path.
contentPathcontent/tweetsLocation of post MDX files and assets. You can organize them in whichever way you want, e.g. place them in sub-directories.
fullRelativePathfalseWhen set to true, include full path relative to contentPath in path of generated posts.
mdxOtherwiseConfiguredfalseSet this flag true if gatsby-plugin-mdx is already configured for your site.
pruneLength160MDX body is pruned to this length for description on MdxTweet. 160 characters is the maximum description length that Google displays in search results.

Frontmatter

KeyRequiredDescription
idTwitter ID.
titleTweet title, which will be slugified.
slugOverride slugified title.
urlURL of original tweet, which is also used as canonical URL.
threadThread ID to group tweets into a thread.
tagsArray of tags. For full tag support you need to install and configure @maiertech/gatsby-theme-tags-core.
imagesArray of images with src (relative path to image), optional title and mandatory alt text. All images are displayed below the tweet.
linksArray of links to additional resources. Each link has title and href props.

Schema customization

Tweet interface

FieldTypeDescription
idID!Tweet ID.
collectionString!Collection to which this tweet belongs.
titleString!From frontmatter.
descriptionString!excerpt from parent Mdx node.
userStringFrom frontmatter.
urlString!From frontmatter.
threadStringFrom frontmatter.
tags[String!]From frontmatter.
images[TweetImage!]
links[TweetResource!]
bodyString!String representation of tweet body from parent Mdx node.
pathString!Path to generated page starts with collection, then full relative path if fullRelativePath is true, then slug derived from title.

Type MdxTweet implements Tweet. If you prefer to use a data source other than MDX files, you can write a child theme that implements the Tweet interface.

TweetImage type

FieldTypeDescription
srcFile!Relative path to image.
titleStringImage title.
altString!Image alt text.

TweetResource type

FieldTypeDescription
titleString!Link title.
hrefString!Link href.