1.0.1 β€’ Published 2 years ago

gatsby-theme-paste v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Gatsby Theme Paste

A unofficial Gatsby blog theme using Paste with high accecibility and inclusion.

Installation

For a new site

If you want to create a new site with this theme, run the command below. This will generate a new site with all necessary configurations.

gatsby new my-paste-blog https://github.com/shyamajp/gatsby-theme-paste-starter

For an existing site

  1. Install the theme
  npm install gatsby-theme-paste
  1. Add the configuration to your gatsby-config.js file
module.exports = {
  plugins: [
    {
      resolve: `gatsby-theme-paste`,
      options: {
        // basePath defaults to `/`
        basePath: `/blog`,
      },
    },
  ],
};
  1. Add blog posts to your site by creating md or mdx files inside /content/posts or your customised contentPath.

  2. Run your site.

gatsby develop

By default, your site will be running at http://localhost:8000.

Usage

This is an example project structure

Project Structure

πŸ“‚ my-paste-blog
+---πŸ“œ gatsby-config.js
+---πŸ“œ package.json
β”‚
+---πŸ“‚ content
    +---πŸ“‚ assets
    β”‚   +---πŸ–ΌοΈ avatar.png
    β”‚   +---πŸ–ΌοΈ default.jpg
    β”‚   +---πŸ–ΌοΈ main.jpg
    β”‚
    +---πŸ“‚pages
    β”‚   +---πŸ“œ about.md
    β”‚   +---πŸ“œ contact.md
    β”‚   +---πŸ“œ privacy-and-policy.md
    β”‚
    +---πŸ“‚post
    +---πŸ“œ my-first-blog.md
    +---πŸ“œ my-second-blog.mdx
    +---πŸ“‚ my-third-blog
        +---πŸ“œ blog-content.mdx
        +---πŸ–ΌοΈ blog-image.jpg

Theme options

KeyDefault valueDescription
basePath/Root url for all blog posts
contentPathcontent/postsLocation of blog posts
limit1000Set the amount of pages that should be generated

Example Usage

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: "gatsby-theme-paste",
      options: {
        // basePath defaults to `/`
        basePath: "/blog",
        // number of posts in one page
        postsPerPage: 10,
      },
    },
  ],
};

Site Metadata Configuration

KeyTypeDescription
titleStringSite title for SEO
descriptionStringSite description for SEO
authorAuthor detail displayed in the sidebar and footer
author.nameStringName of the author
author.descriptionStringDescription of the author
siteUrlStringSite url
menuLinks[]Menu items displayed in the header
menuLinks.nameStringName of the menu item
menuLinks.linkStringLink of the menu item
quickLinks[]Quick link items displayed in the footer
quickLinks.nameStringName of the quick link item
quickLinks.linkStringLink of the quick link item
social[]Social links displayed in the sidebar and footer
social.nameStringName of the social site
social.urlStringUrl of the social site

In addition to the theme options, there are a handful of items you can customize via the siteMetadata object in your site's gatsby-config.js.

Example Usage

// gatsby-config.js
module.exports = {
  siteMetadata: {
    // Used for SEO
    title: "My Blog Title",
    description: "My site description",
    // Used for SEO in the footer and sidebar
    author: {
      name: "shyamajp",
      description: "I love technologies!",
    },
    // Used for resolving images in social cards
    siteUrl: "https://example.com",
    // Used for internal links in the header
    menuLinks: [
      {
        name: "Home",
        link: "/",
      },
      {
        name: "About",
        link: "/about",
      },
    ],
    // Used for quick links in the footer
    quickLinks: [
      {
        name: "Home",
        link: "/",
      },
      {
        name: "About",
        link: "/about",
      },
      {
        name: "Tags",
        link: "/tags",
      },
      {
        name: "Categories",
        link: "/about",
      },
    ],
    // Used for social links in the footer and sidebar
    social: [
      {
        name: "Twitter",
        url: "https://twitter.com/gatsbyjs",
      },
      {
        name: "GitHub",
        url: "https://github.com/gatsbyjs",
      },
      {
        name: "YouTube",
        url: "https://www.youtube.com/",
      },
      {
        name: "LinkedIn",
        url: "https://www.linkedin.com/",
      },
    ],
  },
};

Blog Post Fields

The following are the defined blog post fields based on the node interface in the schema

FieldType
titleString
bodyString
dateDate
tagsString[]
excerptString
imageString
imageAltString
type"post" or "page"

An example markdown looks like the following:

---
title: "Blog title"
date: 2022-01-01
image: "./blog-image.jpg"
description: "This is just an example description."
categories:
  - "technologies"
  - "tutorial"
tags:
  - "react"
  - "gatsby"
type: "post"
---

# Yay

This blog renders!

Contributions

TBA

Report a bug

via Issues

Open a discussion

via Discussions

Make a contribution

via PR

License

MIT