Skip to content

Commit

Permalink
Merge pull request #27 from imranhsayed/feature/add-yoast-seo
Browse files Browse the repository at this point in the history
Add Yoast seo
  • Loading branch information
imranhsayed authored Oct 20, 2020
2 parents 749901c + 9da58f9 commit 94a66eb
Show file tree
Hide file tree
Showing 22 changed files with 197 additions and 99 deletions.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
7. Offline Search Feature
8. Categories, Archive Page, Custom Home Page
9. Custom Widgets, Menus
10. Yoast seo support

## 🌐 Live Demo

Expand All @@ -40,21 +41,19 @@
## 🚀 Set Up

### Gatsby Setup
* Rename [`.env-example`](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/site/.env-example) in site directory file to `.env` and add your WordPress SITE_URL in `site` directory :
* Rename [`.env-example`](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/site/.env-example) in site directory file to `.env` and add your WordPress SITE_URL and FRONTEND_URL in `site` directory :
`SITE_URL=https://example.com`

### WordPress Setup
1. Upload and activate all the plugins from wordpress/plugins folder of this repo, into your WordPress Site.

OR,

a. Clone the WordPress plugin [Headless CMS](https://github.com/imranhsayed/headless-cms) in your WordPress
plugin directory and activate it.

b. Clone and activate [wp-graphql](https://github.com/wp-graphql/wp-graphql) -test on ( v0.8.3 ) in WordPress plugin directory.
c. Clone and activate [wp-graphiql](https://github.com/wp-graphql/wp-graphiql) in WordPress plugin directory.
d. Clone and activate [wp-graphql-acf](https://github.com/wp-graphql/wp-graphql-acf) in WordPress plugin directory.
e. Install and activate [ACF WordPress plugin](https://wordpress.org/plugins/advanced-custom-fields/) in the WordPress.
1. On your WordPress site, download, Upload and activate all the plugins from wordpress/plugins folder of this repo, into your WordPress Site.

a. [Headless CMS](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/wordpress/plugins/headless-cms.zip)
b. [wp-graphql](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/wordpress/plugins/wp-graphql.zip)
c. [wp-graphiql](https://github.com/wp-graphql/wp-graphiql)
d. [ACF WordPress plugin](https://wordpress.org/plugins/advanced-custom-fields/)
e. [wp-graphql-acf](https://github.com/wp-graphql/wp-graphql-acf)
f. [Yoast-SEO](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/wordpress/plugins/wordpress-seo.14.5.zip)
g. [wp-graphql-yoast-seo](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/wordpress/plugins/wp-graphql-yoast-seo.zip)

2. - Set Header menu as `HCMS Header Menu`

Expand Down
23 changes: 12 additions & 11 deletions packages/gatsby-wordpress-theme-phoenix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Backend in WordPress.
7. Offline Search Feature
8. Categories, Archive Page, Custom Home Page
9. Custom Widgets, Menus
10. Yoast seo support


## 👨‍💻 Maintainer
Expand Down Expand Up @@ -58,25 +59,25 @@ module.exports = {
{
resolve: "gatsby-wordpress-theme-phoenix",
options: {
wordPressUrl: 'xxxx'
wordPressUrl: 'xxxx',
frontendUrl: 'https://example.com'
}
} ]
};
```

### WordPress Site Setup

1. Upload and activate all the plugins from [wordpress/plugins](https://github.com/imranhsayed/gatsby-wordpress-themes/tree/master/wordpress/plugins), into your WordPress Site.
### WordPress Setup
1. On your WordPress site, download, Upload and activate all the plugins from wordpress/plugins folder of this repo, into your WordPress Site.

OR,

a. Clone the WordPress plugin [Headless CMS](https://github.com/imranhsayed/headless-cms) in your WordPress
plugin directory and activate it.

b. Clone and activate [wp-graphql](https://github.com/wp-graphql/wp-graphql) -test on ( v0.8.3 ) in WordPress plugin directory.
c. Clone and activate [wp-graphiql](https://github.com/wp-graphql/wp-graphiql) in WordPress plugin directory.
d. Clone and activate [wp-graphql-acf](https://github.com/wp-graphql/wp-graphql-acf) in WordPress plugin directory.
e. Install and activate [ACF WordPress plugin](https://wordpress.org/plugins/advanced-custom-fields/) in the WordPress.
a. [Headless CMS](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/wordpress/plugins/headless-cms.zip)
b. [wp-graphql](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/wordpress/plugins/wp-graphql.zip)
c. [wp-graphiql](https://github.com/wp-graphql/wp-graphiql)
d. [ACF WordPress plugin](https://wordpress.org/plugins/advanced-custom-fields/)
e. [wp-graphql-acf](https://github.com/wp-graphql/wp-graphql-acf)
f. [Yoast-SEO](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/wordpress/plugins/wordpress-seo.14.5.zip)
g. [wp-graphql-yoast-seo](https://github.com/imranhsayed/gatsby-wordpress-themes/blob/master/wordpress/plugins/wp-graphql-yoast-seo.zip)

2.
* Set Header menu as `HCMS Header Menu`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { slash } = require( `gatsby-core-utils` );
const singlePageTemplate = require.resolve(`../src/templates/archive/index.js`);
const createPaginatedPages = require('gatsby-paginate');
const {SeoFragment} = require( './fragments/seo/index.js' );

// Get all the posts.
const GET_POSTS = `
Expand All @@ -13,13 +14,19 @@ query GET_POSTS {
slug
uri
id
seo {
...SeoFragment
}
posts(first: 5000) {
edges {
node {
id
title
uri
date
seo{
...SeoFragment
}
categories {
edges {
node {
Expand Down Expand Up @@ -55,6 +62,7 @@ query GET_POSTS {
}
}
}
${SeoFragment}
`;

module.exports = async ( { actions, graphql } ) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const SeoFragment = `
fragment SeoFragment on hwgraphql_SEO {
canonical
title
metaDesc
metaRobotsNoindex
metaRobotsNofollow
opengraphAuthor
opengraphDescription
opengraphTitle
opengraphDescription
opengraphImage {
sourceUrl
}
opengraphUrl
opengraphSiteName
opengraphPublishedTime
opengraphModifiedTime
twitterTitle
twitterDescription
twitterImage {
sourceUrl
}
}
`;

module.exports.SeoFragment = SeoFragment;
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
const { slash } = require( `gatsby-core-utils` );
const frontPageTemplate = require.resolve(`../src/templates/front-page/index.js`);
const {SeoFragment} = require( './fragments/seo/index.js' );

// Get all the front page data.
const GET_FRONT_PAGE = `
query GET_FRONT_PAGE {
HWGraphQL {
pageBy(uri: "home") {
title
seo {
...SeoFragment
}
frontPageMeta {
fieldGroupName
banner {
Expand Down Expand Up @@ -162,6 +166,7 @@ query GET_FRONT_PAGE {
}
}
}
${SeoFragment}
`;

module.exports = async ( { actions, graphql } ) => {
Expand Down
5 changes: 5 additions & 0 deletions packages/gatsby-wordpress-theme-phoenix/create-pages/pages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { slash } = require( `gatsby-core-utils` );
const customTemplates = [ '/blog/', '/', '/blog', 'blog' ];
const singlePageTemplate = require.resolve(`../src/templates/page/index.js`);
const {SeoFragment} = require( './fragments/seo/index.js' );

// Get all the pages.
const GET_PAGES = `
Expand All @@ -13,6 +14,9 @@ query GET_PAGES {
content
date
uri
seo {
...SeoFragment
}
featuredImage {
altText
sourceUrl
Expand Down Expand Up @@ -42,6 +46,7 @@ query GET_PAGES {
}
}
}
${SeoFragment}
`;

module.exports = async ( { actions, graphql } ) => {
Expand Down
5 changes: 5 additions & 0 deletions packages/gatsby-wordpress-theme-phoenix/create-pages/posts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { slash } = require( `gatsby-core-utils` );
const singlePostPageTemplate = require.resolve(`../src/templates/post/index.js`);
const {SeoFragment} = require( './fragments/seo/index.js' );

// Get all the posts.
const GET_POSTS = `
Expand All @@ -13,6 +14,9 @@ query GET_POSTS {
content
date
uri
seo {
...SeoFragment
}
featuredImage {
altText
sourceUrl
Expand Down Expand Up @@ -42,6 +46,7 @@ query GET_POSTS {
}
}
}
${SeoFragment}
`;

module.exports = async ( { actions, graphql } ) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/gatsby-wordpress-theme-phoenix/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module.exports = ({ wordPressUrl }) => ({
module.exports = ({ wordPressUrl, frontendUrl }) => ({
siteMetadata: {
title: `Gatsby WordPress Theme`,
description: `Gatsby WordPress Theme`,
author: `@imranhsayed`,
siteUrl: `${frontendUrl}`
},
plugins: [
`gatsby-plugin-react-helmet`,
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-wordpress-theme-phoenix/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-wordpress-theme-phoenix",
"version": "2.0.6",
"version": "2.0.7",
"description": "Gatsby WordPress Theme Phoenix",
"main": "index.js",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { StaticQuery, graphql } from 'gatsby';
/**
* Internal dependencies.
*/
import SEO from "../seo";
import { Header } from "./header-static";

/**
Expand Down Expand Up @@ -52,10 +51,7 @@ export default ( props ) => {
}
` }
render={ data => (
<>
<SEO title="Phoenix: Gatsby WordPress Theme" header={ data.HWGraphQL.header }/>
<Header data={ data }/>
</>
<Header data={ data }/>
) }
/>
)
Expand All @@ -66,7 +62,6 @@ Header.propTypes = {
};

Header.defaultProps = {
siteTitle: 'Phoenix: Gatsby WordPress Theme',
data: {
HWGraphQL: {}
},
Expand Down
Loading

1 comment on commit 94a66eb

@vercel
Copy link

@vercel vercel bot commented on 94a66eb Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.