eugelogic / gatsby-press Goto Github PK
View Code? Open in Web Editor NEWGatsby with Headless WordPress
Home Page: https://www.gatsbypress.co.uk/
License: MIT License
Gatsby with Headless WordPress
Home Page: https://www.gatsbypress.co.uk/
License: MIT License
Consider using ENV variables for some of your configuration settings. For example, the WP URL.
This allows people to switch out different settings between development, staging and production should they need to (which is quite often a yes).
It's also a good place to store API keys as the ENV variables should NOT be uploaded to the repository.
I would recommend you use the .env
file for local, and your hosts ENV options on production. Ensure you do not commit .env
to your repo though.
Consider using Promise.all()
exports.createPages = async ({ actions, graphql }) => {
await Promise.all([
createPages({ actions, graphql }),
createPosts({ actions, graphql }),
createCategories({ actions, graphql }),
createTags({ actions, graphql }),
createUsers({ actions, graphql })
]);
}
It might be worth seeing if there is a speed improvement in the build as well
Use promise.all()
or promise.allSettled()
instead of individual await
statements
exports.createPages = async ({ actions, graphql }) => {
await Promise.all([
createPages({ actions, graphql }),
createPosts({ actions, graphql }),
createCategories({ actions, graphql }),
createTags({ actions, graphql }),
createUsers({ actions, graphql })
]);
}
Once gatsbypress.co.uk is fully propagate update the following:
This one is a bit opinionated, and depends if you want to build in support for a particular host out of the box.
This plugin will automatically add some of the security headers required to pass Security Headers and will provide an easy way to provide additional headers if you need them. Of course, this only supports Netlify.
In the "createUsers.js" and where necessary
This is because when you query all the posts, you can filter only by author and not by user
Make sure to use where: {hasPublishedPosts: POST}
It's good practice to have a robots.txt
file, and can be useful during development to prevent additional sites being crawled. I personally prefer that my robots.txt file be control by the environment. However, controlling this via the WordPress settings may also be a good idea.
Example:
{
resolve: `gatsby-plugin-robots-txt`,
options: {
policy: [{ userAgent: `*`, disallow: `/` }],
}
},
Following the issue with Transform node fields with gatsby-source-graphql I realised something else might not be right.
If I change the url in the options of the gatsby-source-graphql plugin, and use a totally different url for the createLocalLink
function, the content fetched will be the right one but the function will use the url provided in the gatsby-source-graphql rather than one specified in the createLocalLink
function by means of utils and config files.
Of course you would never used two different urls but I wonder why Gatsby is using the one on gatsby-config.js rather than the one in config.js
p a:hover,
p a:active {
text-decoration: none;
}
https://css-tricks.com/snippets/css/simple-and-nice-blockquote-styling/
and maybe more
WordPress sites have an RSS feed, so it would be great if GatsbyPress also has an RSS feed out of the box. There is already a plugin to do this, it just needs configuration.
I did follow the warning in graphiql and used databaseId
instead of postId
but after hours of banging my head wondering why my code didn't work, I realised that I should have stuck with the latter.
Someone opened an issue at wp-graphql/wp-graphql#1166
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
gatsby
, gatsby-plugin-google-analytics
, gatsby-source-graphql
)react
, react-dom
)gatsby
, gatsby-plugin-google-analytics
, gatsby-source-graphql
)react
, react-dom
)package.json
gatsby 2.22.9
dotenv 8.2.0
gatsby-plugin-google-analytics 2.3.2
gatsby-plugin-prefetch-google-fonts 1.4.3
gatsby-source-graphql 2.5.2
react 16.13.1
react-dom 16.13.1
prettier 2.0.5
Hi Guys,
I am using Gravity Formas user registration addon I can update user meta of the logged-in user only but I want also to update user meta whenever admin fills a form by entering user Email in the Email field.
Whenever Admin fills a form and enters email id which is users' email and all the populated fields should be updated to the user holding the Email.
Please give a golden or suggest a plugin
Thanks
Aman Kumar Shah
As establish on Slack with Chris, the createLocalLink
function on /utils/index.js is a hack because the gatsby-source-graphql plugin doesn't offer a search and replace feature for imported urls.
Once plugin gets that feature we can remove createLocalLink
Since you are at it, also add a visual aid if a top level menu label has any children, maybe add a chevron V
A web manifest file will allow you to set the background, theme, and images used when installing & loading your website to a mobile or a desktop.
It will also setup the Favicon for you as well, meaning you don't have to include one in the static folder.
This is an easy win to bring a site closer to being a valid PWA.
change <div>
to <header>
the add the following style
header {
border-bottom: 1px solid grey;
}
header h2 a {
text-decoration: none;
text-transform: uppercase;
color: black;
}
Find out if you can do by passing the id only on pages like https://github.com/eugelogic/gatsby-press/blob/master/create/createPages.js
min-height: 100px;
display: flex;
justify-content: center;
align-items: center;
border-top: 1px solid grey;
As things currently stand, I can only fetch all the users as long as they have a post under their name.
Subscribers will not be fetched.
But what can I do if I need a list of all the authors/editors only?
wp-graphql/wp-graphql#900
If this is not feasible I should change user
to author
where possible and try not to have username in the slug
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.