# gatsby-theme-wordpress-blog

> A core, data-only theme for adding a blog to your site, with content from WordPress.

Latest version **1.0.0-4** (published 2022-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install gatsby-theme-wordpress-blog
pnpm add gatsby-theme-wordpress-blog
yarn add gatsby-theme-wordpress-blog
bun add gatsby-theme-wordpress-blog
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-4 |
| Published | 2022-10-18 |
| First published | 2022-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | jxnblk |

## Links

- npm: https://www.npmjs.com/package/gatsby-theme-wordpress-blog
- npm.io page: https://npm.io/package/gatsby-theme-wordpress-blog

## Dependencies (8)

- [sharp](https://npm.io/package/sharp.md) ^0.29.3
- [sanitize-html](https://npm.io/package/sanitize-html.md) ^2.7.0
- [gatsby-plugin-image](https://npm.io/package/gatsby-plugin-image.md) ^2.23.1
- [gatsby-plugin-sharp](https://npm.io/package/gatsby-plugin-sharp.md) ^4.23.1
- [gatsby-source-wordpress](https://npm.io/package/gatsby-source-wordpress.md) ^6.23.1
- [gatsby-transformer-sharp](https://npm.io/package/gatsby-transformer-sharp.md) ^4.23.1
- [gatsby-transformer-remark](https://npm.io/package/gatsby-transformer-remark.md) ^5.22.0
- [gatsby-theme-abstract-blog](https://npm.io/package/gatsby-theme-abstract-blog.md) 1.0.0-3

## Recent versions

- 1.0.0-4 (latest) — 2022-10-18
- 1.0.0-3 — 2022-10-17
- 1.0.0-2 — 2022-04-12
- 1.0.0-1 — 2022-03-23
- 1.0.0-0 — 2022-02-25

## README

# Gatsby Theme WordPress Blog

A core, data-only theme for adding a blog to your site, with content from WordPress.

## Get started

Install the theme and add it to your Gatsby site's `gatsby-config.js`.

```sh
npm i gatsby-theme-wordpress-blog
```

```js
// gatsby-config.js
require("dotenv").config({
  path: `.env.${process.env.NODE_ENV}`,
})

module.exports = {
  plugins: [
    "gatsby-theme-wordpress-blog",
    // ...
  ],
}
```

Add `.env.development` and `.env.production` files with the following environment variable defined:

```sh
// .env example
WPGRAPHQL_URL=""
```

### Add templates

This theme requires that your site include two templates in its `src` directory.
By default it expects these templates to exist:

- `src/templates/blog-index.js`
- `src/templates/blog-post.js`

Add these two templates to your site.

```js
// src/templates/blog-index.js
import * as React from "react"
import { Link } from "gatsby"

export default function BlogIndex({ posts }) {
  return (
    <div>
      <h1>Blog</h1>
      <ul>
        {posts.map((post) => (
          <li key={post.id}>
            <Link to={`/blog/${post.slug}`}>{post.title}</Link>
          </li>
        ))}
      </ul>
    </div>
  )
}
```

```js
// src/templates/blog-post.js
import * as React from "react"

export default function BlogPost(props) {
  return (
    <div>
      <h1>{props.title}</h1>
      <div
        dangerouslySetInnerHTML={{
          __html: props.html,
        }}
      />
    </div>
  )
}
```

## Options

```js
// example gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: "gatsby-theme-wordpress-blog",
      options: {
        postPath: "src/templates/blog-post",
        indexPath: "src/templates/blog-index",
      },
    },
  ],
}
```

- `postPath`: relative path to template for the blog post pages
- `indexPath`: relative path to template for the blog index page

---
_Source: https://npm.io/package/gatsby-theme-wordpress-blog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
