Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cometkim/gatsby-plugin-pagemeta

A GatsbyJS plugin to use comments as page metadata.
https://github.com/cometkim/gatsby-plugin-pagemeta

gatsby gatsby-plugin

Last synced: 3 days ago
JSON representation

A GatsbyJS plugin to use comments as page metadata.

Awesome Lists containing this project

README

        

# gatsby-plugin-pagemeta

A GatsbyJS plugin to use comments as page metadata.

## Usage

```bash
yarn add gatsby-plugin-pagemeta
```

Add plugin to the `gatsby-config.js`

```js
plugins: ['gatsby-plugin-pagemeta']
```

See [types](./src/types.ts) for more detail.

## Example

```tsx
// in pages/my-page.js

// @pageMeta:title My Page
// @pageMeta:description An example page

const MyPage: React.FC = () => {
// ...
};

export default MyPage;
```

This plugin extracts the metadata from comments, so you can query them from otherside like

```graphql
query Navigation {
allSitePage {
nodes {
path
context {
pageMeta {
title
description
}
}
}
}
}
```

## License

MIT