/quickstart-gatsbyserver

Primary LanguageJavaScriptBoost Software License 1.0BSL-1.0

Gatsby

quickstart-gatsby-site

Customized structure Expertise Soluctions for development of static websites with gatsby.

Server Model When possible to put the server link here.

πŸš€ start

  1. Starting to developing.

    start the project.

    >git clone https://github.com/expertisesolutions/quickstart-gatsby-site/
  2. Starting to developing.

    Navigate to your new website directory and install the /node_modues dependencies.

    >cd quickstart-gatsby-site/
    >yarn install
  3. Starting to developing.

    Navigate to your new website directory and install the /node_modues dependencies.

    >yarn start

    or

    >gatsby develop
  4. Open the source code and start editing!

    Your site is now running at http://localhost:8000!

    Note: You'll also see a second link: http://localhost:8000/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.

    Open the quickstart-gatsby-site directory in your code editor of choice and edit src/pages/index.js. Save your changes and the browser will update in real time!

🧐 What's inside?

A quick look at the top-level files and directories you'll see in a Gatsby project.

.
β”œβ”€β”€ node_modules
β”œβ”€β”€ config
β”œβ”€β”€ src
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .prettierrc
β”œβ”€β”€ gatsby-browser.js
β”œβ”€β”€ gatsby-config.js
β”œβ”€β”€ gatsby-node.js
β”œβ”€β”€ gatsby-ssr.js
β”œβ”€β”€ LICENSE
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
└── README.md
  1. /node_modules: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.

  2. /config: Directory for the insertion of metadata and plugins that have a very long configuration.

  3. /src: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. src is a convention for β€œsource code”.

  4. .gitignore: This file tells git which files it should not track / not maintain a version history for.

  5. .prettierrc: This is a configuration file for Prettier. Prettier is a tool to help keep the formatting of your code consistent.

  6. gatsby-browser.js: This file is where Gatsby expects to find any usage of the Gatsby browser APIs (if any). These allow customization/extension of default Gatsby settings affecting the browser.

  7. gatsby-config.js: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the config docs for more detail).

  8. gatsby-node.js: This file is where Gatsby expects to find any usage of the Gatsby Node APIs (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.

  9. gatsby-ssr.js: This file is where Gatsby expects to find any usage of the Gatsby server-side rendering APIs (if any). These allow customization of default Gatsby settings affecting server-side rendering.

  10. LICENSE: License used by Expertise Solutions.

  11. package-lock.json (See package.json below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. (You won’t change this file directly).

  12. package.json: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.

  13. README.md:A text file containing useful reference information about the project.

Plugins and gatsby-config.js

  1. siteMetadata: When you want to reuse common pieces of data across the site (for example, your site title), you can store that data in siteMetadata, path ./config/metadata.js.
  2. gatsby-plugin-react-helmet:Provides drop-in support for server rendering data added with React Helmet (uses react-helmet).
  3. gatsby-plugin-sitemap:Create a sitemap for your Gatsby site.

NOTE: This plugin only generates output when run in production mode! To test your sitemap, run: gatsby build && gatsby serve

  1. gatsby-plugin-nprogress: Automatically shows the nprogress indicator when a page is delayed in loading (which Gatsby considers as one second after clicking on a link).
  2. gatsby-plugin-google-analytics:This plugin uses Google’s analytics.js file under the hood.
  3. gatsby-plugin-manifest:The web app manifest (part of the PWA specification) enabled by this plugin allows users to add your site to their home screen on most mobile browsers β€” see here. The manifest provides configuration and icons to the phone.
  4. gatsby-plugin-styled-components:A Gatsby plugin for styled-components with built-in server-side rendering support.
  5. gatsby-plugin-page-creator:Gatsby plugin that automatically creates pages from React components in specified directories. Gatsby includes this plugin automatically in all sites for creating pages from components in src/pages. You can also leverage the File System Route API to programmatically create pages from your data.(You may include another instance of this plugin if you’d like to create additional β€œpages” directories or want to override the default usage.)
  6. gatsby-plugin-offline:Adds drop-in support for making a Gatsby site work offline and more resistant to bad network connections. It uses Workbox Build to create a service worker for the site and loads the service worker into the client. ( If you’re using this plugin with gatsby-plugin-manifest (recommended) this plugin should be listed after that plugin so the manifest file can be included in the service worker.)
  • Optional
    • gatsby-plugin-canonical-urls:if necessary the creation of canonical urls, an important tool for seo

πŸŽ“ Learning Gatsby

  • consult documentation. check out the Guides, API Reference, and Advanced Tutorials sections in the sidebar.

ESLint

To run eslint and fix problems run:

qickstarter-gatsbyserver $ npx eslint --fix .

It should resolve almost every problem, but some may be only spotted which will be diagnosed.