Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/americanexpress/react-seo

โœจ Simple SEO tag manager for React
https://github.com/americanexpress/react-seo

meta one-app seo

Last synced: 4 days ago
JSON representation

โœจ Simple SEO tag manager for React

Awesome Lists containing this project

README

        


React SEO

[![npm version](https://badge.fury.io/js/%40americanexpress%2Freact-seo.svg)](https://badge.fury.io/js/%40americanexpress%2Freact-seo)
[![Build Status](https://travis-ci.org/americanexpress/react-seo.svg?branch=main)](https://travis-ci.org/americanexpress/react-seo)

> Simple SEO tag manager for React

## ๐Ÿ‘ฉโ€๐Ÿ’ป Hiring ๐Ÿ‘จโ€๐Ÿ’ป

Want to get paid for your contributions to `react-seo`?
> Send your resume to [email protected]

## ๐Ÿ“– Table of Contents

* [Usage](#Usage)
* [API](#API)
* [Contributing](#Contributing)


## ๐Ÿคนโ€ Usage

```bash
npm install @americanexpress/react-seo
```


Let's start with a minimal example of basic usage:

```javascript
import React from 'react';
import SEO from '@americanexpress/react-seo';

const MyModule = () => (




);

export default MyModule;
```

This will result in the following tags being added to the `head` element:

```html

Lorem Ipsum










```

Notice in the example above that the Open Graph and Twitter Card metadata is constructed from the `title`, `description`, and `image` props. To override these values or add additional tags not provided by default, you may use the `openGraph` and `twitterCard` props.

```javascript
import React from 'react';
import SEO from '@americanexpress/react-seo';

const MyModule = () => (




);

export default MyModule;
```


## ๐ŸŽ›๏ธ API

The interface for `react-seo` is denoted below:

```javascript
SEO.propTypes = {
children: oneOfType([
arrayOf(node),
node,
]),
title: string,
description: string,
canonical: string,
image: shape({
src: string,
secureUrl: string,
type: string,
width: number,
height: number,
alt: string,
}),
video: shape({
src: string,
secureUrl: string,
type: string,
width: number,
height: number,
alt: string,
}),
openGraph: shape({
type: string,
url: string,
title: string,
description: string,
determiner: string,
locale: string,
localeAlternate: string,
siteName: string,
image: shape({
src: string,
secureUrl: string,
type: string,
width: number,
height: number,
alt: string,
}),
video: shape({
src: string,
secureUrl: string,
type: string,
width: number,
height: number,
alt: string,
}),
audio: shape({
src: string,
secureUrl: string,
type: string,
}),
}),
twitterCard: shape({
card: string,
title: string,
description: string,
image: shape({
src: string,
alt: string,
}),
site: string,
siteId: string,
creator: string,
creatorId: string,
app: shape({
country: string,
iphone: shape({
id: string,
url: string,
name: string,
}),
ipad: shape({
id: string,
url: string,
name: string,
}),
googlePlay: shape({
id: string,
url: string,
name: string,
}),
}),
player: shape({
src: string,
width: number,
height: number,
}),
}),
keywords: arrayOf(string),
robots: arrayOf(string),
locale: string,
meta: arrayOf(object),
siteUrl: string,
alternateLinks: arrayOf(shape({
hreflang: string,
href: string,
}))
};

SEO.defaultProps = {
children: null,
article: false,
author: '',
description: '',
image: null,
keywords: [],
robots: [],
locale: 'en-US',
meta: [],
pathname: '',
siteUrl: '',
title: '',
canonical: '',
alternateLinks: [],
};
```


## ๐Ÿ† Contributing

We welcome Your interest in the American Express Open Source Community on Github.
Any Contributor to any Open Source Project managed by the American Express Open
Source Community must accept and sign an Agreement indicating agreement to the
terms below. Except for the rights granted in this Agreement to American Express
and to recipients of software distributed by American Express, You reserve all
right, title, and interest, if any, in and to Your Contributions. Please [fill
out the Agreement](https://cla-assistant.io/americanexpress/react-seo).

Please feel free to open pull requests and see [CONTRIBUTING.md](./CONTRIBUTING.md) for commit formatting details.

## ๐Ÿ—๏ธ License

Any contributions made under this project will be governed by the [Apache License
2.0](https://github.com/americanexpress/react-seo/blob/main/LICENSE.txt).

## ๐Ÿ—ฃ๏ธ Code of Conduct

This project adheres to the [American Express Community Guidelines](https://github.com/americanexpress/react-seo/wiki/Code-of-Conduct).
By participating, you are expected to honor these guidelines.