Gatsby Use sitemetada

GUS by Edu4Dev


Shortcut to request business data written on gatsby-config.js siteMetadata.

🚀 Quick start

To get started to log data on your build, you can follow these steps:

  1. Install Gatsby Use siteMetadata gatsby-plugin with the follow command:
npm i gatsby-use-sitemetadata

🧐 What’s inside?

This plugin generates the files Gatsby looks for inside node_modules.

/gatsby-use-sitemetadata

├── src/tools

├────── useSitemetaData.js

├── LICENSE(0BSD)

├── package.json

└── README.md
  1. Plug and Play

There’s no need to configure the plugin, just plug-n-play inside your custom block:


import { useSiteMetadata } from 'gatsb-use-sitemetadata'

const MyAwesomeComponent = ({subAgent}) => {
	return <p>{useSiteMetadata.message}</p>
}

export default MyAwesomeComponent

Here is the query you’re requesting for:

query {
	site {
		siteMetadata {
			title
			headline
			basePath
			name
			version
			developer
			coauthorBusiness
			project
			url
			message
		}
	}
}
  1. Verify the plugin was added correctly

If the plugin aren’t working Gatsby will break.

🎓 Learning Gatsby

If you’re looking for more guidance on plugins, how they work, or what their role is in the Gatsby ecosystem, check out some of these resources: