gatsby-theme-open-sourcerer
A configurable and performant minimal gatsby portfolio theme for open source developers.
Live Demo
Installing the theme
- Create a site
You can easily bootstrap a site by using the starter theme. For this, you have to have gatsby-cli installed. Now run the following command:
gatsby new my-site https://github.com/sh4hids/gatsby-starter-open-sourcerer
- Start development server
After installation process has finished, nevigate to the project and run the following command:
cd my-site
gatsby develop
- See the theme in action
Open http://localhost:8000
in your browser to see your site in action or visit http://localhost:8000/___graphql
to check the graphql playground.
- Start hacking
Open the current directory in your favorite code editor and start hacking the theme.
NB All the available commands can be found here.
Customizing default configuration
You can provide necessary configuration via plugin options on gatsby-config.js
. Copy the default configuration from here and customize as you need. If you bootstrapped your site by using the starter kit, you just have to customize the my-site/src/config/index.js
file.
Component shadowing
If you want to customize a component, you can use theme shadowing. Create the following directories in your src folder:
├── src
│ ├── @sh4hids
│ │ └── gatsby-theme-open-sourcerer
For example, if you want to shadow the BrandLogo
component, your directory structure will be like this:
├── src
│ ├── @sh4hids
│ │ └── gatsby-theme-open-sourcerer
│ │ └── components
│ │ ├── BrandLogo.js
You can shadow any component you like by following the above structure. All the components can be found in src
dorectory of this repo.
N.B. You might get some error while shadowing a component. This might happen if copy/paste components from this theme’s src
folder. One of the error might be:
Module not found: Error: Can't resolve '../components' in
In the above case, check if there’s any relative import. If there’s any, refactor the imports
like this:
import { Text } from '@sh4hids/gatsby-theme-open-sourcerer/src/components';
import { DefaultLayout } from '@sh4hids/gatsby-theme-open-sourcerer/src/layouts';
Writing posts
You can write blog post using markdown
file format. Just follow this structure:
// contents/blog/your-post.md
---
title: My Awesome Post
slug: my-awesome-post
publishedAt: 2021-07-30
isPublished: true
tags:
- test
- web dev
---
Your post will go here...
NB: If you want to make draft post, set isPublished
to false
in post’s frontmatter. You can use this script to automate the process.
Customizing pages
Contents for the following pages are required for this theme to work properly. You have to provide the contents in .yml
format in your contents folder.
- Projects (content structure)
- Uses (content structure)
Customizing About/Contact page
Create files named About.js
/Contact.js
in the following directory:
├── src
│ ├── @sh4hids
│ │ ├── gatsby-theme-open-sourcerer
│ │ │ ├── templates
│ │ │ │ ├── About.js
│ │ │ │ ├── Contact.js
Page layout
Copy the base layout for each of the pages from the following links and customize as you like.
Using built-in components
You can import and use any components from the source folder. Some of the default components directories are:
Example:
import { Box } from '@shahids/gatsby-theme-open-sourcerer/src/components';
Adding post comment
The theme has the commenting feature on the article page, which uses utterances under the hood. utterances
is a lightweight comments widget built on GitHub issues. To set up utterances
, you have to create a public GitHub repository and add utterances app on that repo. Now add utterancesCommentRepo
key in your theme config file (your-site/src/config/index.js
) with your repository name as a value (i.e. sh4hids/shahid.pro-comments
).
Performance
Want to help?
If you want to help in any way to make the theme better, you are welcome. Some of the ways you can help are:
- Reporting an issue (bug)
- Improving the documentation (README)
- Adding your site to the showcase section
Want to offer me a Cofee?
If you like the theme and want to buy me a coffee, please follow the link 👇