Gatby.js Themes: how to use this new feature

March 20, 2023

Tags: Technologies



Among all the technologies available to create, develop and update web applications and other similar projects, Gatsby.js stands out. This framework will allow you to create fast and scalable web pages, adapting to the needs of any company.


On the website of this static site generator, they point out that "it allows developers to create fast, secure and powerful websites using a React-based framework and an innovative data layer that makes the integration of different content, APIs and services in a web experience incredibly simple.


In addition to the aforementioned, Gatsby.js is versatile since it is possible to adjust it to the needs of each company or company in its web pages or applications: it can be of great benefit for companies that are dedicated to education, NGOs, financial companies, e-commerce platforms and others.


“With Gatsby js, your site will be a lightning-fast progressive web application right out of the box. That means pages load in milliseconds and transitions feel smooth."


Equally noteworthy is its ease of use for developers, in addition to the fact that there are multiple tutorials and libraries with which they can learn and thus make the most of all the functions of Gatby.js.



gatsby js


What are themes in Gatsby.Js


Let's take another look at what they tell us in their official documentation about this new feature “Gatsby themes are plugins that include a gatsby-config.js file and add preconfigured functionality, data sources, and/or UI code to themes. Gatsby sites. You can think of the Gatsby topics as separate Gatsby sites that can be pushed together and allow you to break up a larger Gatsby project!”


How to use Gatsby themes


Gatsby themes are reusable packages of pre-built Gatsby functionality that can be easily installed on your Gatsby site to add new features and style. Here are the steps to use Gatsby themes in your project:


Create a new Gatsby site: Start by creating a new Gatsby site with the gatsby-cli tool, using the following command in your terminal:


gatsby new my site


Install a Gatsby theme – You can install a Gatsby theme using npm or yarn. For example, if you want to use the Gatsby Starter Blog theme, run the following command:


npm install gatsby-theme-blog


This will install the theme and all its dependencies in your project.


Configure the theme: To configure the theme, you need to create a gatsby-config.js file in the root of your project and add the theme to the plugin array. For example, to configure the Gatsby Starter Blog theme, add the following code to your gatsby-config.js file:


module.exports = {
   plugins: [
       resolve: "gatsby-theme-blog",
       options: {},


Customize the theme: You can customize the theme by overriding its default components and styles. To do this, create a new file in your project in the same location and with the same name as the component you want to override. For example, to override the default header component of the Gatsby Starter Blog theme, create a new file at src/gatsby-theme-blog/components/header.js.


Start the development server – Once you have installed and configured the theme, you can start the development server by running the following command:


gatsby develop


This will start the development server at http://localhost:8000 and you will be able to see your site with the theme installed.


That's all! Now you can use Gatsby themes in your project to easily add new features and styling.


gatsby js


Gatsby js salient features


  • It is very fast, allows you to compile and build web pages faster.
  • Deliver faster the content your visitors request on the web.
  • Websites built with Gatsby js have fewer vulnerabilities.
  • It allows you to combine data from different sources without complications.
  • Gatsby js combines technologies like GraphQL and Webpack.
  • Gatsby js allows you to quickly scale your website when you have high traffic spikes.


gatsby js


What types of web pages are best to create with Gatsby.js


The versatility of Gatsby.js is one of the most celebrated aspects of this technology, but there are a few types of web pages that benefit the most from the features of this static site generator:


  • Homepage of a company
  • Business blog
  • Documentation website
  • Custom landing pages
  • Lead Generation Websites and SEO
  • University web pages
  • Site of a campaign or event
  • Data visualization web page


At Rootstack we use Gatsby.js on our own website. A technology was needed that would allow it to replace a project that was no longer scalable and in which all implementations had to fulfill several functions. The team of experts decided to turn to Gatsby.js in order to fix it.


We recommend you on video